The OpenD Programming Language

rand

Return Value

Type: T

Uniformly distributed enumeration.

Examples

enum A { a, b, c }
auto e = rand!A;
import mir.random.engine.xorshift;
auto gen = Xorshift(1);
enum A { a, b, c }
auto e = gen.rand!A;
import mir.random.engine.xorshift;
auto gen = Xorshift(1);
enum A : dchar { a, b, c }
auto e = gen.rand!A;
import mir.random.engine.xorshift;
auto gen = Xorshift(1);
enum A : string { a = "a", b = "b", c = "c" }
auto e = gen.rand!A;

Meta