[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: float and random number generator
On Monday 07 June 2004 09:23, aksingh@xxxxxxxxxxx wrote:
>
> Thanks Sven, but would a & not be better than a % to get a value
> between 0 and my max value, i.e i can do a (get_random_bytes_returned
> & max_value). Does this in anyway reduce randomnness ?
> Any suggestions are welcome.
Unless your 'max_value' is always something like (2^n)-1 you'll have a
lot less randomness -- potentially only 1-bit worth.
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive: http://mail.nl.linux.org/kernelnewbies/
FAQ: http://kernelnewbies.org/faq/