Zig Version
0.16.0, but also in master
Steps to Reproduce, Observed Behavior, and Expected Behavior
in std/Random/lcg.zig line 9:
/// Linear congruent generator where the modulo is `std.math.maxInt(T)`,
However, if you have a look at the impl, it uses the % operator which does modulo operations against std.math.maxInt(T)+1 not std.math.maxInt(T) (I just ran into this issue myself which is how I stumpled upon this):
pub fn next(lcg: *LcgSelf) T {
lcg.xi = (lcg.a *% lcg.xi) +% lcg.c;
return lcg.xi;
}
### Zig Version
0.16.0, but also in master
### Steps to Reproduce, Observed Behavior, and Expected Behavior
in `std/Random/lcg.zig` line `9`:
```
/// Linear congruent generator where the modulo is `std.math.maxInt(T)`,
```
However, if you have a look at the impl, it uses the % operator which does modulo operations against `std.math.maxInt(T)+1` not `std.math.maxInt(T)` (I just ran into this issue myself which is how I stumpled upon this):
```
pub fn next(lcg: *LcgSelf) T {
lcg.xi = (lcg.a *% lcg.xi) +% lcg.c;
return lcg.xi;
}
```