Implement #85440 (Random test ordering) by smoelius · Pull Request #89082 · rust-lang/rust (original) (raw)

can we use a proper RNG library like fastrand or oorandom or rand

I tried rand and oorandom actually. In both cases, I got can't find crate for core errors.

My impression (based on this, this, and this) is that a crate has to go out of its way to be a dependency of a builtin library. And none of those crates seem to do that. (I could be misunderstanding though.)

Note that oorandom barely uses core, but it does use it for Range (here).

there is no proof that state = sip13_hash((state, extra)) is a good RNG.

(and additionally rand_u64() % n produces biased result)

Your points are very well taken. However, I don't think this random number generator needs to be "strong." Put another way, I think the risk of an attacker trying to manipulate the test ordering is low. I am open to counterarguments though.

(Thanks for doing this, BTW.)