Why do Zig, Rust and Julia give different random numbers when I give them the same seed and algorithm?
Ziggit
Why do Zig, Rust and Julia give different random numbers when I give them the same seed and algorithm?
I have this sample code snippet in Zig that generates 10 random f32 and puts them in a slice. const std = @import("std"); pub fn main() void { var prng_state = std.Random.Xoshiro256.init(0); const prng = prng_state.random(); var slice: [10]f32 = undefined; for (0..slice.len) |idx| { slice[idx] = prng.float(f32); } std.debug.print("{any}\n", .{slice}); } This outputs the following: { 0.27175805, 0.25162527, 0.30172718, 0.011619115, 0.3952554, 0.029364...
0 comments
No comments yet.