MCPcopy Create free account
hub / github.com/HaxeFoundation/hxcpp / rnd_int

Function rnd_int

src/hx/libs/std/Random.cpp:114–132  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

112}
113
114static unsigned int rnd_int( rnd *r )
115{
116 unsigned int y;
117 int pos = r->cur++;
118 if( pos >= NSEEDS ) {
119 int kk;
120 for(kk=0;kk<NSEEDS-MAX;kk++)
121 r->seeds[kk] = r->seeds[kk+MAX] ^ (r->seeds[kk] >> 1) ^ mag01[r->seeds[kk] % 2];
122 for(;kk<NSEEDS;kk++)
123 r->seeds[kk] = r->seeds[kk+(MAX-NSEEDS)] ^ (r->seeds[kk] >> 1) ^ mag01[r->seeds[kk] % 2];
124 r->cur = 1;
125 pos = 0;
126 }
127 y = r->seeds[pos];
128 y ^= (y << 7) & 0x2b5b2500;
129 y ^= (y << 15) & 0xdb8b0000;
130 y ^= (y >> 16);
131 return y;
132}
133
134static double rnd_float( rnd *r )
135{

Callers 2

rnd_floatFunction · 0.85
_hx_std_random_intFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected