aboutsummaryrefslogtreecommitdiff
path: root/compile.c
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2024-08-03 17:33:18 -0400
committerBruce Hill <bruce@bruce-hill.com>2024-08-03 17:33:18 -0400
commit68b34cf00b8a52509c0bed7b1e66b3e40de0c4f5 (patch)
tree04ffa2538865b4a342c78d677026b3703f6e4d41 /compile.c
parent99b00530ceaf787a936cd37894e2dbf5b6e612ce (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.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/compile.c b/compile.c
index 0f8c792e..3b6b50f9 100644
--- a/compile.c
+++ b/compile.c
@@ -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),