Generating Strings with Random Contents
Joseph Rushton Wakeling via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Wed Jul 16 16:27:35 PDT 2014
> Alternative:
>
> randomSample(lowercase, 10, lowercase.length).writeln;
No, I don't think that's appropriate, because it will pick 10 individual
characters from a, b, c, ... , z (i.e. no character will appear more than once),
and the characters picked will appear in alphabetical order.
Incidentally, if lowercase has the .length property, there's no need to pass the
length separately to randomSample. Just passing lowercase itself and the number
of sample points desired is sufficient.
More information about the Digitalmars-d-learn
mailing list