1

I tried to follow those post

Get a random number focused on center

Generate random number between two numbers in JavaScript

I have a minimum value A ex : -100 I have a maximum value B ex : 100 I have a dispersionLevel C ([0, 1])

what I would like is

when C = 1, I can generate a random value between -100*1=-100 and 100*1=100, but with a high tendency to be in the range of (-100*1)*0.5=-50 and (100*1)*0.5=50

When C = 0.5, I can generate a random value between -100*0.5=-50 and 100*0.5=50 but with a high tendency of being in the range of (-100*0.5)*0.5=-25 and (100*0.5)*0.5=25

When C = 0, I can generate a random value between -100*0 and 100*0 but with a high tendency of being in the range of (-100*0)*0.5=0 and (100*0)*0.5=0

This because, I have a center point, the more I am close to this center point, the more dispersed the value can be, but the more distant I am, the less dispersed those value can be.

I was about to use a bell like the examples, they highly increase the probability that it goes to the center, but I can still have value that will go occasionally outside of the borders.

That is why, the more I go far, the more the range will also shrink.

Here is my broken fiddle

https://jsfiddle.net/hums08pg/1/

Bobby
  • 4,372
  • 8
  • 47
  • 103

0 Answers0