import std.string; import std.array : array; import std.random; import std.file; import vibe.http.server; import taggedalgebraic; struct Error {}; union U { string[] args; Error e; } alias Result = TaggedUnion!U; auto shuffle(string[] args, const string t) { Result r; switch(t){ case "mt": Mt19937 gen; gen.seed(unpredictableSeed); args.randomShuffle(gen); break; case "x": Xorshift32 gen; gen.seed(unpredictableSeed); args.randomShuffle(gen); break; case "du": auto gen = DevRandomGen!"/dev/urandom"(); args.randomShuffle(gen); break; case "dr": auto gen = DevRandomGen!"/dev/random"(); args.randomShuffle(gen); break; default: r = Error(); return r; } r = args; return r ; } template DevRandomGen(string gen) if (gen == "/dev/random" || gen == "/dev/urandom") { struct DevRandomGen { alias UIntType = uint; public: enum bool isUniformRandom = true; enum empty = false; /// Smallest generated value. enum UIntType min = 0; /// Largest generated value. enum UIntType max = ubyte.max; string src = gen; void seed(UIntType x0) @safe pure nothrow @nogc {} void popFront() @safe pure nothrow @nogc {} @property UIntType front() const { return (cast(ubyte[])(src.read(ubyte.sizeof)))[0]; } @property typeof(this) save() @safe pure nothrow @nogc { return this; } } } enum firstPage = `
...a man, being just as hungry as thirsty, and placed in between food and drink, must necessarily remain where he is and starve to death.
This is the Buridan's Donkey main page.
Do not be afraid to ask for the help of the Donkey
you have four possibilities: