import std.random, std.range, std.stdio; void main() { foreach (_; 0 .. 100) { immutable seed = unpredictableSeed(); writeln(seed, " => ", randomSample(iota(100), 1, Random(seed)).front); } } -------- The random generator is assigned to the Range only after it was primed and the default constructed random generator always returns the same first value.
Commits pushed to master at https://github.com/D-Programming-Language/phobos https://github.com/D-Programming-Language/phobos/commit/aa896e08ccbdb3deee98658f09022bdb4c5dc503 set random generator in constructor - Bug 8314 was already fixed by adding a _first flag https://github.com/D-Programming-Language/phobos/commit/92335506d309d4f06e1757b149c5069d02ac1174 Merge pull request #654 from dawgfoto/fix8314 fix issue 8314