== Quote from Walter Bright (newshou...@digitalmars.com)'s article > Andrei Alexandrescu wrote: > > 2. The global random generator will be allocated per thread. Are you > > cool with this too? > That could have speed problems with a tight loop accessing thread local > storage.
I don't think this matters, since for apps that really need it, a RNG can be explicitly passed in. This is purely a convenience feature for when you want random number generation to "just work" even if it's not the most efficient thing in the world. Also, checking thread_needLock() is dirt cheap, in my experience faster than accessing TLS. You could also have a global, non-thread local RNG that is used if a check to thread_needLock() returns false. > If it's a shared global with no locking, the thread randomness > will increase its randomness <g>. Yay, D's getting hardware random number generators!!!