Oh yeah, the random number functions in ROM are difficult to read.
That's because number_mm() returns random numbers within some range (greatly lowered by that right shift, which isn't really necessary with modern pseudorandom number generators). If you go and mod the result by, say, 100 to get a percentage, there'll be a skew since there are more random numbers which result in 1 than 99. So instead, it goes through a loop until it finds a random number within your range, which should be evenly distributed. So to answer your question, they're all as random as your system's pseudorandom number generator, and avoid distribution skews that programmers often introduced by using mod to truncate the system's random function. I think the range of number_bits is 0 to (2^width - 1). --Mike On 10/28/06, Sandi Fallon <[EMAIL PROTECTED]> wrote:
Okay, I have a newbie question (ie, something I should have asked long ago). How do the functions number_percent(), number_range(), and number_bits() differ in randomness, if at all? And what IS the range of number_bits? Thanks, Sandi -- ROM mailing list [email protected] Unsubscribe here ->>> http://www.rom.org/cgi-bin/mailman/listinfo/rom
-- ROM mailing list [email protected] Unsubscribe here ->>> http://www.rom.org/cgi-bin/mailman/listinfo/rom

