Doc Comments / Phobos /
Std Random
std.random
|
Comments
Add your comments here...
Comparing D's std.rand with C's rand
D's std.rand is slower than C's rand, but it's more random.
Shared Seed State
By the looks of the documentation - haven't checked the code - the std.random module shares a single seed state.
IMO this is wrong. What if one wanted to conduct several repeatable tests concurrently - perhaps because the measured aspects were running in multiple threads?
It should be rewritten as a class, as in:
class Random { public: this(uint seed, uint index); this();Also, why not use provide extensed sized random values, e.g. 64-bits, perhaps combining 2 successive uints into a ulong? Sure, it can be done in client code, but better to have it done once only in Phobos.public: uint rand();
// Implementation . . . }
(from NG:digitalmars.D.bugs/834)
Links