diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2024-08-03 17:33:18 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2024-08-03 17:33:18 -0400 |
| commit | 68b34cf00b8a52509c0bed7b1e66b3e40de0c4f5 (patch) | |
| tree | 04ffa2538865b4a342c78d677026b3703f6e4d41 /compile.c | |
| parent | 99b00530ceaf787a936cd37894e2dbf5b6e612ce (diff) | |
Fix array:random() to return a random item using correct RNG logic,
rather than a reference.
Diffstat (limited to 'compile.c')
| -rw-r--r-- | compile.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -1861,7 +1861,7 @@ CORD compile(env_t *env, ast_t *ast) } else if (streq(call->name, "random")) { CORD self = compile_to_pointer_depth(env, call->self, 0, false); (void)compile_arguments(env, ast, NULL, call->args); - return CORD_all("Array$random(", self, ")"); + return CORD_all("Array$random_value(", self, ", ", compile_type(item_t), ")"); } else if (streq(call->name, "sample")) { CORD self = compile_to_pointer_depth(env, call->self, 0, false); arg_t *arg_spec = new(arg_t, .name="count", .type=Type(IntType, .bits=64), |
