On Dec 4, 12:07 am, "don.aman" <[EMAIL PROTECTED]> wrote: > Since we're being all high-level, it'd be good for a random function > which allows us to specify the range of numbers, since % doesn't > promise an even spread of probabilities (especially for large ranges).
Sure it does, as long as you get enough random bits that scaling the output of the number to an arbitrary range doesn't lose more random bits than it promises to give. It's not the PRNG's responsibility to do that, it's the responsibility of the function doing the scaling. Furthermore, if you're in floating-point arithmetic, then scaling by powers of two doesn't lose any bits as long as the numbers don't overflow or underflow. You'll lose a bit or two from going from the powers of two to the range you want, but you can always get a few extra random bits to account for that if you're concerned. mfh --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~----------~----~----~----~------~----~------~--~---