Pseudo-random numbers/Xorshift star: Difference between revisions
Pseudo-random numbers/Xorshift star (view source)
Revision as of 09:48, 13 August 2020
, 3 years ago→{{header|Factor}}: call it by its true name >:)
m (→{{header|Factor}}: call it by its true name >:)) |
|||
Line 86:
<lang factor>USING: accessors kernel literals math math.statistics
prettyprint sequences ;
CONSTANT: mask64 $[ 1 64 shift 1 - ]
Line 92 ⟶ 91:
CONSTANT: const 0x2545F4914F6CDD1D
TUPLE: xorshift
: <xorshift
mask64 bitand xorshift
: twiddle ( m n -- n ) dupd shift bitxor mask64 bitand ;
Line 103 ⟶ 102:
state<< const * mask64 bitand -32 shift mask32 bitand ;
: next-float ( obj --
! ---=== Task ===---
1234567 <xorshift
987654321 >>state
|