From df849891c1131fba12d170fb76eea626606c017b Mon Sep 17 00:00:00 2001 From: Xotchkass <78706300+Xotchkass@users.noreply.github.com> Date: Thu, 14 Aug 2025 13:35:25 +0300 Subject: [PATCH] use runtime.random_generator_read_bytes in read procedure instead of filling it manually. --- core/math/rand/rand.odin | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/core/math/rand/rand.odin b/core/math/rand/rand.odin index ece864f35..2fceee736 100644 --- a/core/math/rand/rand.odin +++ b/core/math/rand/rand.odin @@ -508,18 +508,8 @@ Possible Output: */ @(require_results) read :: proc(p: []byte, gen := context.random_generator) -> (n: int) { - pos := i8(0) - val := i64(0) - for n = 0; n < len(p); n += 1 { - if pos == 0 { - val = int63(gen) - pos = 7 - } - p[n] = byte(val) - val >>= 8 - pos -= 1 - } - return + if !runtime.random_generator_read_bytes(gen, p) {return 0} + return len(p) } /*