On Thursday, 25 February 2016 at 17:27:25 UTC, Andrei Alexandrescu wrote:
So we have https://dlang.org/phobos/std_random.html#.randomCover which needs to awkwardly allocate memory to keep track of the portions of the array already covered.

This could be fixed by devising a PRNG that takes a given period n and generates all numbers in [0, n) in exactly n steps.

However, I've had difficulty finding such PRNGs. Most want the maximum period possible so they're not concerned with a given period. Any insights?

I don't think that's a good idea. A prng is closed path through a state space and it doesn't matter where you start on said path, you're going to follow the same closed path through the state space.

I don't know of an algorithm for generating random permutations that isn't in-place (or O(N) storage), but I'm not an expert on the topic so maybe one does exist.

Reply via email to