Close seeds in random number generation can produce similar random numbers?

I use sequential seeds (1,2,3,4, ...) to generate random numbers in a simulation. Does the fact that the seeds are close to each other also generate the generated pseudorandom numbers?

I think this doesn’t change anything, but I use python

Edit: I did some tests and the numbers are not alike. But I am afraid that the similarities cannot be seen simply by looking at the numbers. Is there any theoretical feature of random number generation that ensures that different seeds produce completely independent pseudorandom numbers?

+5
source share
6 answers

. , , , , .

, . Microsoft ++ rand 0 9:

   38  7719 21238  2437  8855 11797  8365 32285 10450 30612
   41 18467  6334 26500 19169 15724 11478 29358 26962 24464
   45 29216 24198 17795 29484 19650 14590 26431 10705 18316
   48  7196  9294  9091  7031 23577 17702 23503 27217 12168
   51 17945 27159   386 17345 27504 20815 20576 10960  6020
   54 28693 12255 24449 27660 31430 23927 17649 27472 32640
   58  6673 30119 15745  5206  2589 27040 14722 11216 26492
   61 17422 15215  7040 15521  6516 30152 11794 27727 20344
   64 28170   311 31103 25835 10443   497  8867 11471 14195
   68  6151 18175 22398  3382 14369  3609  5940 27982  8047
+2

, . RNG RNG, RNG .

RNG, , , .

masterSeed <- 42
masterRNG <- new Random(masterSeed)

childRNGs[] <- array of child RNGs

foreach childRNG in childRNGs
   childRNG.setSeed(masterRNG.next())
endforeach
+2

, , Mersenne Twister , . python linux , , ( ) random.SystemRandom(). SystemRandom , . :

import random
myrandom = random.SystemRandom
x = myrandom.random       # yields a number in [0,1)
dump x out to file...

,

import random
read x from file...
newseed = int(x*(2**31))  # produce a 32 bit integer
random.seed(newseed)
nextran = random.random()
nextran = random.random()...
+1

: . : . : .

.

0

?

( ), , , , , .

, , . , .

0

:

Mersenne Twister:

  • 2 ** 19937-1.
  • .

I will be more worried that my code is broken than my RNG, which is not random enough. In general, your gut feelings about chance will be wrong - the human mind is really good at finding patterns, even if they don't exist.

As long as you know that your results will not be β€œsafe” due to your random seeding, you should be fine.

0
source

All Articles