I want my R sets of N random numbers to be independent/uncorrelated. I want them to be as unrelated to each other as a pseudo random number sequences can be.
How should I be setting the seed in each of my R sequences to achieve this task?
I understand that if I set the seed to the same number, say 1, at the start of each of the R sequences, I will get R replicas of the same set of N pseudo random numbers.
What I do not understand is what happens if I set the seed to 1, generate 10 random numbers, then set the seed to 5, and generate second set of 10 random numbers. Would 5 of the random numbers in the two sequences overlap? It does not appear to be the case:
Code:
. clear . set obs 13 number of observations (_N) was 0, now 13 . set seed 10 . gen u = runiform() . list +----------+ | u | |----------| 1. | .6012831 | 2. | .9137043 | 3. | .2667319 | 4. | .6073658 | 5. | .0360737 | |----------| 6. | .75318 | 7. | .4591727 | 8. | .9056994 | 9. | .3134366 | 10. | .3755541 | |----------| 11. | .1387824 | 12. | .9243277 | 13. | .3676381 | +----------+ . clear . set obs 3 number of observations (_N) was 0, now 3 . set seed 20 . gen u = runiform() . list +----------+ | u | |----------| 1. | .7156579 | 2. | .9087018 | 3. | .7972254 | +----------+
0 Response to What is the relationship between a seed and a state of the random number generator?
Post a Comment