Pseudo-random numbers/Splitmix64: Difference between revisions

Doh. Confidently incorrect. Fix some precedence / bit masking problems. Replace wrong expected results with correct ones.
m (→‎{{header|Factor}}: use 2^ instead of ^)
(Doh. Confidently incorrect. Fix some precedence / bit masking problems. Replace wrong expected results with correct ones.)
Line 34:
* Show the first five integers generated using the seed 1234567.
 
90867735753951555926457827717110365317
3203168211198807973
12075168200337577354
53608812888353565179817491932198370423
4593380528125082431
10975871416297420776
16408922859458223821
2494458855142162015
 
* Show that for an initial seed of 987654321, the counts of 100_000 repetitions of <code>floor next_float() * 5</code> is as follows:
 
0: 1992920027, 1: 1981719892, 2: 2008520073, 3: 2012219978, 4: 2004720030
 
* Show your output here, on this page.
Line 59 ⟶ 60:
;* [[Pseudo-random numbers/PCG32‎‎]]
;* [[Pseudo-random_numbers/Xorshift_star]]
 
 
 
=={{header|C}}==
Line 222 ⟶ 225:
 
method next-int {
my $next = $!state += ($!state + 0x9e3779b97f4a7c15) +& (2⁶⁴ - 1);
$next = ($next +^= ($next +> 30)) * 0xbf58476d1ce4e5b9 +& (2⁶⁴ - 1);
$next = ($next +^= ($next +> 27)) * 0x94d049bb133111eb +& (2⁶⁴ - 1);
($next +^ ($next +> 31)) +& (2⁶⁴ - 1);
}
 
Line 243 ⟶ 246:
{{out}}
<pre>Seed: 1234567; first five Int values
6457827717110365317
9086773575395155592
3203168211198807973
12075168200337577354
9817491932198370423
5360881288835356517
4593380528125082431
10975871416297420776
16408922859458223821
2494458855142162015
 
Seed: 987654321; first 1e5 Rat values histogram
Bag(0(1992920027) 1(1981719892) 2(2008520073) 3(2012219978) 4(2004720030))</pre>
 
=={{header|Wren}}==
10,327

edits