use runtime.random_generator_read_bytes in read procedure instead of filling it manually.

This commit is contained in:
Xotchkass
2025-08-14 13:35:25 +03:00
parent 71e992d5bf
commit df849891c1
+2 -12
View File
@@ -508,18 +508,8 @@ Possible Output:
*/ */
@(require_results) @(require_results)
read :: proc(p: []byte, gen := context.random_generator) -> (n: int) { read :: proc(p: []byte, gen := context.random_generator) -> (n: int) {
pos := i8(0) if !runtime.random_generator_read_bytes(gen, p) {return 0}
val := i64(0) return len(p)
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
} }
/* /*