random number including 1 - i.e. [0,1]

Esmail ebonak at hotmail.com
Tue Jun 9 19:57:50 EDT 2009


Miles Kaufmann wrote:
> 
> I'm curious what algorithm calls for random numbers on a closed interval.

I'm implementing a Particle Swarm Optimizer. Depending on what paper you
read you'll see mention of required random values "between 0 and 1"
which is somewhat ambiguous. I came across one paper that specified
the range [0,1], so inclusive 1, which was the reason for my question.
(I'm still looking for other papers to see if I can get more information
exactly on the range)

I think in the end it probably doesn't matter if it's [0, 1) or
[0, 1] as the max values for each will probably be very close.

Esmail




More information about the Python-list mailing list