This is wrong D2 code because randomCover is probably unable to use a char[] (while it's able to use a dchar[]). But instead of giving a compile-time error (like sort does if you try to sort a char[]) this produces a run-time error: import std.stdio, std.random, std.array; void main() { char[] data = "ABCDEF".dup; array(randomCover(data, rndGen)); // OK writeln(randomCover(data, rndGen)); // runtime error } DMD 2.057 gives at run-time: core.exception.AssertError@std.random(1260): Assertion failure ---------------- ...\dmd2\src\phobos\std\format.d(1394): D3std6format240__T11formatValueTS3std5stdio4File17LockingTextWriterTS3std6random156__T11RandomCC5041E8639AC9593490B587E3A11ED51 ...\dmd2\src\phobos\std\format.d(2056): D3std6format242__T13formatGenericTS3std5stdio4File17LockingTextWriterTS3std6random156__T11RandoCF38C173958DE37C3A1B1FB41B1E1E4E ...\dmd2\src\phobos\std\format.d(390): D3std6format243__T14formattedWriteTS3std5stdio4File17LockingTextWriterTaTS3std6random156__T11Ra21BBED73A15ED2D7DD23A5859960F47B ...\dmd2\src\phobos\std\stdio.d(680): D3std5stdio4File197__T5writeTS3std6random156__T11RandomCoverTAaTS3std6random98__T21MersenneTwisBA2E7D5419D9E1A48EA3D0223CAF316C ...\dmd2\src\phobos\std\stdio.d(1516): D3std5stdio197__T7writelnTS3std6random156__T11RandomCoverTAaTS3std6random98__T21MersenneTwister3E21F503D8BD64EF969BB07907936D5C ...\test.d(5): _Dmain ---------------- E
A compile time error since 2.060: Error: template std.random.randomCover does not match any function template declaration. Candidates are: ... http://dpaste.dzfl.pl/6a9de69a00b0