diff --git a/src/optional/wren_opt_random.wren b/src/optional/wren_opt_random.wren index 829337e3..b94f53b3 100644 --- a/src/optional/wren_opt_random.wren +++ b/src/optional/wren_opt_random.wren @@ -51,7 +51,7 @@ foreign class Random { sample(list, count) { if (count > list.count) Fiber.abort("Not enough elements to sample.") - // There at (at least) two simple algorithms for choosing a number of + // There are (at least) two simple algorithms for choosing a number of // samples from a list without replacement -- where we don't pick the same // element more than once. // @@ -76,7 +76,7 @@ foreign class Random { // Find an index that we haven't already selected. var index while (true) { - index = int(count) + index = int(list.count) if (!picked.containsKey(index)) break } diff --git a/src/optional/wren_opt_random.wren.inc b/src/optional/wren_opt_random.wren.inc index ff217a4f..4ccbc5e9 100644 --- a/src/optional/wren_opt_random.wren.inc +++ b/src/optional/wren_opt_random.wren.inc @@ -53,7 +53,7 @@ static const char* randomModuleSource = " sample(list, count) {\n" " if (count > list.count) Fiber.abort(\"Not enough elements to sample.\")\n" "\n" -" // There at (at least) two simple algorithms for choosing a number of\n" +" // There are (at least) two simple algorithms for choosing a number of\n" " // samples from a list without replacement -- where we don't pick the same\n" " // element more than once.\n" " //\n" @@ -78,7 +78,7 @@ static const char* randomModuleSource = " // Find an index that we haven't already selected.\n" " var index\n" " while (true) {\n" -" index = int(count)\n" +" index = int(list.count)\n" " if (!picked.containsKey(index)) break\n" " }\n" "\n"