Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2019
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. public Double findLenght(Double lenght) {
  2. Double random = Math.random();
  3. if(Math.random() >= 0.5) {
  4. random = - random;
  5. }
  6. Double phi;
  7. if(random < 0) {
  8. phi = (1 / (Math.sqrt(2) * Math.PI)) * Math.exp((-Math.pow(random, 2))/2);
  9. }
  10. else {
  11. phi = 1 / ((1 / (Math.sqrt(2) * Math.PI)) * Math.exp((-Math.pow(random, 2))/2));
  12. }
  13. Double finalLenght = lenght * phi;
  14. return finalLenght;
  15. //phi représente une valeur que tu vas multiplier à la taille moyenne de ton poisson (lenght)
  16. //dans le cas où random < 0, phi sera plus faible (donc taille plus petite)
  17. //sinon, phi sera plus grand que 1 (taille plus élevée)
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement