Module: Rand

Defined in:
ext/enterprise_script_service/mruby/benchmark/bm_ao_render.rb

Constant Summary collapse

BNUM =
1 << 29
BNUMF =
BNUM.to_f
@@x =

Use xorshift

123456789
@@y =
362436069
@@z =
521288629
@@w =
88675123

Class Method Summary collapse

Class Method Details

.randObject



21
22
23
24
25
26
27
28
# File 'ext/enterprise_script_service/mruby/benchmark/bm_ao_render.rb', line 21

def self.rand
  x = @@x
  t = x ^ ((x & 0xfffff) << 11)
  w = @@w
  @@x, @@y, @@z = @@y, @@z, w
  w = @@w = (w ^ (w >> 19) ^ (t ^ (t >> 8)))
  (w % BNUM) / BNUMF
end