zig
zig copied to clipboard
std.Random: add functions with explicit index type
Should address #13247; this doesn't make enumValue
or shuffle
consistent across architectures, but it does allow one to use the alternative function to specify an integer with a bit width independent of the architecture.
Also added some simple comptime checks to enumValue
*, to take advantage of some possible invariants.
I am going to push a commit to rectify doc comments, but for the record, all tests have passed:
The other two functions shuffle
and shuffleWithIndex
seem to be a very similar case so maybe we can have the same docs for them too just like above? Linking between them and explaining why shuffle
is not independent of the target.