On Tue, Nov 10, 2009 at 11:41 AM, John Harrop <jharrop...@gmail.com> wrote:

> user=> (take 10 (p-lazy-seq 3 true (thread-local-rand 10)))
> (1 2 6 1 5 1 7 8 4 3)
>
> This should generate the random numbers on multiple threads, using multiple
> RNGs. In the limit, on multicore hardware and with a slow enough RNG
> implementation (e.g. SecureRandom), a consumer of that sequence might be
> able to obtain and use random numbers faster than with direct calls to the
> RNG implementation.
>

Oh, and did I mention the random numbers should also be more *secure*? There
would be multiple SecureRandom (or whatever)  instances and which one is
chosen to produce a given random number will be essentially, well, random,
making it, if possible, even harder to guess the next random number the
consumer will use than if it just used one SecureRandom instance directly.

-- 
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