Isaac, I confess that I don't have any deep insights to offer about these 
architectural questions for your particular situation, but here are a few 
remarks that might be helpful for peripheral issues.

In Clojure 1.6.0, at least, clojure.core/rand uses java.util.Random() 
(seeded by the system time or something like that, I think).  
clojure.data.generators/*rnd* is java.util.Random() seeded with 42, unless 
you fill *rnd* with something else.  As I understand it, java.util.Random() 
is not considered to be a top-notch RNG.  It's good enough for simple use, 
but it may be that your application depends a lot on a large number of 
random numbers, in which case maybe it would be worth using a different 
RNG.  I use ec.util.MersenneTwisterFast() by Sean Luke 
<http://www.cs.gmu.edu/~sean/research/>.

My simulation project is probably a lot simpler in many respects than what 
you're writing.  I have many "persons", with internal states that change, 
and with communication between persons.  I give each person its own RNG, 
each seeded by a number from a single master RNG created at the beginning 
of the simulation run.  

By giving each person its own RNG, I don't have to worry about contention 
for a common RNG when I run different persons in multiple threads.  Giving 
each person its own RNG also means that I don't even have to think about 
the question of whether, after a long series of timesteps, the fact that 
there are there are periodic patterns in how I use the random numbers 
(since I iterate through persons) might possibly encounter a period in the 
output of the RNG.  (I think this is probably *very* unlikely, but I am 
running these simulations for research purposes, so it doesn't hurt to be 
sure.)

By seeding all of the person-specific RNGs from the output of a single RNG, 
whose seed I store, I can easily recreate a run exactly, including 
recreating all of the individual RNGs.

In my case, I can put the RNGs in the persons, since it's only in the 
persons that I ever use randomness (and only during communication, 
actually).  In your application, would it be possible to bundle together 
all of the objects that might involve randomness, so that whenever you need 
an RNG, it's available to anything in that bundle?  Maybe you don't need 
randomness available everywhere?  Not sure if the way I'm putting this 
makes sense.

-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to