Skip to content

Instantly share code, notes, and snippets.

@mwtoews
Created January 31, 2019 10:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mwtoews/8fdd10e25f60a0aa81c33551b4c2a573 to your computer and use it in GitHub Desktop.
Save mwtoews/8fdd10e25f60a0aa81c33551b4c2a573 to your computer and use it in GitHub Desktop.
output from testlwrandom.c
TEST10
R8_UNI computes pseudorandom values.
Two seeds, S1 and S2, are used.
R S1 S2
12345 34567
0.575025 493972830 1406600364
0.945577 390105768 506978341
0.253573 1781664868 1237121178
0.883384 1526187241 1776619217
0.794246 866180343 1308034228
0.976838 1103021545 1152761561
0.246036 1221914854 693555855
0.928839 1942689135 2095505401
0.986301 153034416 182453399
0.232776 1043483711 543601765
TEST11
Examine the average and variance of a
sequence generated by R8_UNI.
Now compute 100000 elements.
Average value = 0.500317
Expecting 0.500000
Variance = 0.083519
Expecting 0.083333
TEST12
Show how the seeds used by R8_UNI,
which change on each step, can be reset to
restore any part of the sequence.
Begin sequence with following seeds
S1 = 12345
S2 = 34567
I R S1 S2
1 0.575025 493972830 1406600364
2 0.945577 390105768 506978341
3 0.253573 1781664868 1237121178
4 0.883384 1526187241 1776619217
5 0.794246 866180343 1308034228
6 0.976838 1103021545 1152761561
7 0.246036 1221914854 693555855
8 0.928839 1942689135 2095505401
9 0.986301 153034416 182453399
10 0.232776 1043483711 543601765
Restart the sequence, using the seeds
produced after step 5:
S1 = 866180343
S2 = 1308034228
I R S1 S2
1 0.976838 1103021545 1152761561
2 0.246036 1221914854 693555855
3 0.928839 1942689135 2095505401
4 0.986301 153034416 182453399
5 0.232776 1043483711 543601765
6 0.660200 434296545 1164011680
7 0.737146 504959834 1069434216
8 0.523365 1937436972 813520136
9 0.065935 446373308 304778527
10 0.106898 560752841 331191459
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment