On Sat, May 1, 2010 at 7:25 PM, Lee Spector <lspec...@hampshire.edu> wrote:
> about how to write a real random bignum generator.

Let n be the bignum upper bound on the desired range. Find the
quotient q and remainder r of n by b = 2^31-1. Generate q random
numbers with upper bound b and one random number with upper bound r.
Now use Horner's method to reconstruct a random bignum from these
random fixnum parts with q additions and multiplications.

This is adding uniformly distributed random variables with disjoint
but abutting ranges. Therefore the sum is again a uniform random
variable.

-Per

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to