summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/std/rand.myr6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/std/rand.myr b/lib/std/rand.myr
index 566a4cf..91dd774 100644
--- a/lib/std/rand.myr
+++ b/lib/std/rand.myr
@@ -56,6 +56,7 @@ pkg std =
generic rand : (lo : @a::(numeric,integral), hi : @a::(numeric,integral) -> @a::(numeric,integral))
generic randnum : (-> @a::(numeric,integral))
+ const randbytes : (buf : byte[:] -> size)
generic rngrand : (rng : rng#, lo : @a::(numeric,integral), hi : @a::(numeric,integral) -> @a::(numeric,integral))
generic rngrandnum : (rng : rng# -> @a::(numeric,integral))
@@ -103,6 +104,10 @@ generic randnum = {
-> rngrandnum(_rng)
}
+const randbytes = {buf
+ -> rngrandbytes(_rng, buf)
+}
+
/*
Generates a random integer from `rng` in the range [lo, hi),
returning the value. The range [lo, hi) must be positive,
@@ -182,7 +187,6 @@ const rngrandbytes = {rng, buf
r >>= 8
;;
-> n
-
}
/* updates random number generator state when we tick over. */