Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public Double findLenght(Double lenght) {
- Double random = Math.random();
- if(Math.random() >= 0.5) {
- random = - random;
- }
- Double phi;
- if(random < 0) {
- phi = (1 / (Math.sqrt(2) * Math.PI)) * Math.exp((-Math.pow(random, 2))/2);
- }
- else {
- phi = 1 / ((1 / (Math.sqrt(2) * Math.PI)) * Math.exp((-Math.pow(random, 2))/2));
- }
- Double finalLenght = lenght * phi;
- return finalLenght;
- //phi représente une valeur que tu vas multiplier à la taille moyenne de ton poisson (lenght)
- //dans le cas où random < 0, phi sera plus faible (donc taille plus petite)
- //sinon, phi sera plus grand que 1 (taille plus élevée)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement