3

Context:

Let's consider a random-number set of 10 integer elements generated by one of the PRNG-C++ approaches using a fixed seed integer, i.e. const int seedMe = 31:

0 1 2 3 4 5 6 7 8 9

Question:

Assuming pseudo-random number generators generate fixed number sequences, which are determined by the seed.

  • For the known seed (seedMe) and the known set size (10), is it conceptually possible to generate the random number corresponding to the index N in advance? For example, generation of the 3rd element of the above set without generating the preceding 0 1 2.
  • If so, is there any practical example of such practice in C++?

Aim of the Question:

For known seed and set size, in my parallel computations, a 1-D random-number global-set is needed, which should be the same for each processor.

Each processor uses a subset of the global-set, and accordingly, a priori knows the global-set indices for the subset. For example, for a 2-processor computation, the first processor needs only i = [0, 4] indexed-random numbers, and the second proc i = [5, 9] indexed ones.

I wonder if we can directly and locally generate the subsets of a global-PRNG set at each processor, hence the discard of any need for parallel communication of any sort.

Community
  • 1
  • 1
Herpes Free Engineer
  • 2,425
  • 2
  • 27
  • 34
  • 1
    Won't a good (seedable) hash-function solve this problem? Just hash each index... – Max Langhof Feb 01 '19 at 17:58
  • 2
    Your question is pretty darn broad, but you might be able to modify or extend [this](https://stackoverflow.com/a/48078247/2166798) to a broader class of generators than LCGs. The trick would be to come up with a matrix representation of the generator's state transformation, after which you could take any arbitrary power of the matrix to advance that many iterations of the generator. – pjs Feb 01 '19 at 18:25

0 Answers0