In the end I used this line since I'm not fussy about the rnd for
this:
auto word = compatibles.byKey.array.choice;
Thank you!
On Saturday, 25 January 2020 at 09:18:01 UTC, Basile B. wrote:
On Saturday, 25 January 2020 at 08:35:18 UTC, mark wrote:
I have this code:
import std.random;
import std.stdio;
void main()
{
auto aa = ["one": 1, "two": 2, "three": 3];
writeln(aa);
auto rnd = rndGen;
auto word =
On Saturday, 25 January 2020 at 08:35:18 UTC, mark wrote:
I have this code:
import std.random;
import std.stdio;
void main()
{
auto aa = ["one": 1, "two": 2, "three": 3];
writeln(aa);
auto rnd = rndGen;
auto word = aa.byKey.choice(rnd);
writeln(word);
}
And in the D
On Saturday, 25 January 2020 at 08:35:18 UTC, mark wrote:
I have this code:
import std.random;
import std.stdio;
void main()
{
auto aa = ["one": 1, "two": 2, "three": 3];
writeln(aa);
auto rnd = rndGen;
auto word = aa.byKey.choice(rnd);
writeln(word);
}
And in the D
On Saturday, 25 January 2020 at 09:06:53 UTC, mark wrote:
On Saturday, 25 January 2020 at 08:59:23 UTC, Basile B. wrote:
On Saturday, 25 January 2020 at 08:35:18 UTC, mark wrote:
[...]
[snip]
[...]
rndGen is a range.
Use `auto word = aa.byKey.choice(rnd.front())` as index
instead.
Then
On Saturday, 25 January 2020 at 08:59:23 UTC, Basile B. wrote:
On Saturday, 25 January 2020 at 08:35:18 UTC, mark wrote:
[...]
rndGen is a range.
Use `auto word = aa.byKey.choice(rnd.front())` as index instead.
Then `rndGen.popFront()` to advance.
no sorry, I didn't read and thought you
On Saturday, 25 January 2020 at 08:59:23 UTC, Basile B. wrote:
On Saturday, 25 January 2020 at 08:35:18 UTC, mark wrote:
I have this code:
import std.random;
import std.stdio;
void main()
{
auto aa = ["one": 1, "two": 2, "three": 3];
writeln(aa);
auto rnd = rndGen;
auto word =
On Saturday, 25 January 2020 at 08:35:18 UTC, mark wrote:
I have this code:
import std.random;
import std.stdio;
void main()
{
auto aa = ["one": 1, "two": 2, "three": 3];
writeln(aa);
auto rnd = rndGen;
auto word = aa.byKey.choice(rnd);
writeln(word);
}
And in the D
I have this code:
import std.random;
import std.stdio;
void main()
{
auto aa = ["one": 1, "two": 2, "three": 3];
writeln(aa);
auto rnd = rndGen;
auto word = aa.byKey.choice(rnd);
writeln(word);
}
And in the D playground it gives this error:
onlineapp.d(8): Error: template