shuffle a character array

celavek via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Jul 20 00:49:38 PDT 2016


Hi

I'm trying to shuffle a character array but I get some 
compilation errors.

*
char[] upper = std.ascii.uppercase.dup;
randomShuffle!(typeof(upper))(upper);

randomShuffle(upper);

example.d(34): Error: template std.random.randomShuffle cannot 
deduce function from argument types !(char[])(char[]), candidates 
are:
/usr/include/dmd/phobos/std/random.d(1822):        
std.random.randomShuffle(Range, RandomGen)(Range r, ref RandomGen 
gen) if (isRandomAccessRange!Range && isUniformRNG!RandomGen)
/usr/include/dmd/phobos/std/random.d(1829):        
std.random.randomShuffle(Range)(Range r) if 
(isRandomAccessRange!Range)

example.d(34): Error: template std.random.randomShuffle cannot 
deduce function from argument types !()(char[]), candidates are:
/usr/include/dmd/phobos/std/random.d(1822):        
std.random.randomShuffle(Range, RandomGen)(Range r, ref RandomGen 
gen) if (isRandomAccessRange!Range && isUniformRNG!RandomGen)
/usr/include/dmd/phobos/std/random.d(1829):        
std.random.randomShuffle(Range)(Range r) if 
(isRandomAccessRange!Range)
*

I thought that I could use a dynamic array as a range ...



More information about the Digitalmars-d-learn mailing list