zig icon indicating copy to clipboard operation
zig copied to clipboard

std.Random: add functions with explicit index type

Open InKryption opened this issue 1 year ago • 2 comments

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.

InKryption avatar Nov 02 '22 22:11 InKryption

I am going to push a commit to rectify doc comments, but for the record, all tests have passed: image

InKryption avatar Nov 03 '22 11:11 InKryption

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.

wooster0 avatar Nov 03 '22 14:11 wooster0