Random

Generates a pseudo random sequence

Members

Functions

front
T front()
popFront
void popFront()

pops the next random value

save
Random save()

Saves the forward range

seed
void seed(T seed_value)
toString
string toString()
value
T value()
value
T value(const(T) max)
value
T value(const(T) from, const(T) to)

Examples

import std.algorithm.comparison : equal;
import std.range : drop, take;

auto r = Random!uint(1234);
auto r_forward = r.save;

assert(equal(r.take(5), r_forward.take(5)));

r = r.drop(7);
assert(r != r_forward);
r_forward = r.save;
assert(r == r_forward);
assert(equal(r.take(4), r_forward.take(4)));