Created
July 18, 2013 03:55
-
-
Save tom-tan/6026626 to your computer and use it in GitHub Desktop.
randomCover 前後で乱数進まないのはおかしい気がする.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Issue 7067 らしい. http://d.puremagic.com/issues/show_bug.cgi?id=7067