map question
forkit
forkit at gmail.com
Sat Jan 22 23:54:27 UTC 2022
On Saturday, 22 January 2022 at 19:55:43 UTC, Stanislav Blinov
wrote:
>
thanks for the explanation. That really helped :-)
writeln( generate!(() => dice(0.6, 1.4)).take(howManyTimes) );
[1, 1, 1, 1, 0]
(or after reading Ali's response - getting rid of rnd, and using
_ )
writeln( howManyTimes.iota.map!(_ => dice(0.6, 1.4)) );
[1, 0, 1, 1, 1]
They produce exactly the same thing, so I guess it comes down to
personal choice now.
More information about the Digitalmars-d-learn
mailing list