Rnd Function

The language reference state the Rnd function will return a uniform random number 0<=x<=1

Can this function return exactly zero or exactly one? This can cause problems when using this function to generate other random numbers. Specifically, the function below to generate normal random variables. This function is faster than the Xojo gaussian function.

=STD*((COS(2PI()RND))(-2LN(RAND))^0.5)+MEAN

The docs say:

http://documentation.xojo.com/index.php?title=Rnd&oldid=39107

If 0 is a problem, compare for it and call again.

I did a 10 million iteration simulation, and I get a minimum of zero, and a maximum of 0.999999. Strange that it gives zero, but not one. I thin I will use

(Rnd + 0.0000009) instead of Rnd

[quote=102758:@Bryan Dodson]I did a 10 million iteration simulation, and I get a minimum of zero, and a maximum of 0.999999. Strange that it gives zero, but not one. I thin I will use
[/quote]

Why is that strange? The docs say (again):

Returns a randomly generated number in the range 0 <= Rnd < 1.

Or if you’re more in tune with typical upper division math notation, [0, 1).