const std = @import("std");
const expect = std.testing.expect;
// Random number generator used all over
pub fn ourRng() !std.rand.DefaultPrng {
return std.rand.DefaultPrng.init(blk: {
var seed: u64 = undefined;
try std.posix.getrandom(std.mem.asBytes(&seed));
break :blk seed;
});
}
// test the generator
test "random generators" {
var first_rng = try ourRng();
for (1..10) |_| {
var second_rng = try ourRng();
try expect(first_rng.random().int(i32) != second_rng.random().int(i32));
first_rng = second_rng;
}
}
Compiles and works. However, when trying to use the generated object, it fails with:
Expected Behavior
std.rand.DefaultPrng seems to be absent from the documentation, thus deprecated, substituted by std.Random.DefaultPrng It should fail or warn about deprecation.
Zig Version
0.13.0
Steps to Reproduce and Observed Behavior
This function:
Compiles and works. However, when trying to use the generated object, it fails with:
Expected Behavior
std.rand.DefaultPrng
seems to be absent from the documentation, thus deprecated, substituted bystd.Random.DefaultPrng
It should fail or warn about deprecation.