Re: ints.choice vs. chars.choice

2019-11-18 Thread Daniel Kozak via Digitalmars-d-learn
On Mon, Nov 18, 2019 at 7:25 PM Steven Schveighoffer via Digitalmars-d-learn wrote: > > > You could also use cast(dchar[]), and avoid the cast back to char. > > -Steve or use byCodeUnit writeln(['a', 'b', 'c'].byCodeUnit.choice);

Re: ints.choice vs. chars.choice

2019-11-18 Thread Steven Schveighoffer via Digitalmars-d-learn
On 11/18/19 12:32 PM, mipri wrote: Howdy, The following program fails to compile if the second line is uncommented: import std; void main() {     writeln([1, 2, 3].choice);     //writeln(['a', 'b', 'c'].choice); } Error: template std.random.choice cannot deduce function from argument

ints.choice vs. chars.choice

2019-11-18 Thread mipri via Digitalmars-d-learn
Howdy, The following program fails to compile if the second line is uncommented: import std; void main() { writeln([1, 2, 3].choice); //writeln(['a', 'b', 'c'].choice); } Error: template std.random.choice cannot deduce function from argument types !()(char[],