Skip to content

Instantly share code, notes, and snippets.

@tom-tan
Created July 18, 2013 03:55
Show Gist options
  • Save tom-tan/6026626 to your computer and use it in GitHub Desktop.
Save tom-tan/6026626 to your computer and use it in GitHub Desktop.
randomCover 前後で乱数進まないのはおかしい気がする.
#!/usr/bin/env rdmd
import std.stdio;
import std.random;
import std.range;
void main(string[] args)
{
writeRandomCovered!Random(10);
}
auto writeRandomCovered(R)(int n)
{
writefln("RandomCover(%s)", R.stringof);
auto rnd = R(unpredictableSeed);
auto arr = iota(0, n).array();
foreach(_; 0..3)
{
writeln(rnd.front);
writeln(arr.randomCover(rnd).array());
writeln(rnd.front);
}
}
@tom-tan
Copy link
Author

tom-tan commented Jul 18, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment