/usr/lib/gcc/x86_64-linux-gnu/5/include/d/rt/util/random.d is in libphobos-5-dev 5.5.0-12ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | /**
* Random number generators for internal usage.
*
* Copyright: Copyright Digital Mars 2014.
* License: $(WEB www.boost.org/LICENSE_1_0.txt, Boost License 1.0).
*/
module rt.util.random;
struct Rand48
{
nothrow:
private ulong rng_state;
void defaultSeed()
{
import ctime = core.stdc.time : time;
seed(cast(uint)ctime.time(null));
}
void seed(uint seedval)
{
assert(seedval);
rng_state = cast(ulong)seedval << 16 | 0x330e;
popFront();
}
auto opCall() @nogc
{
auto result = front;
popFront();
return result;
}
@property uint front() @nogc
{
return cast(uint)(rng_state >> 16);
}
void popFront() @nogc
{
immutable ulong a = 25214903917;
immutable ulong c = 11;
immutable ulong m_mask = (1uL << 48uL) - 1;
rng_state = (a*rng_state+c) & m_mask;
}
enum empty = false;
}
|