Today we learn that Rust’s Inverse Riffle Shuffle seems to be much (~10x) slower than their Fisher Yates shuffle on an [i32: 49].

The FY itself still isn’t “fast” - taking 1.6s to do 1M of them. Although if you swap to SmallRng instead of the plain old thread_rng, it drops to 0.6s/M.

Fun times.

Although through a combination of iteration, experimentation, frustration, randomly inserting and removing sigils, and, most crucially, thinking, I’ve got it down to 0.03s/M iterations. Which makes it a lot easier to gather more data for sampling.

Does seem to be biasing on the low side though - averaging about 12M runs for [1, 2, 3, 4, 5, 6] to appear in 4800 samples.

Follow

@zimpenfish hmmmm

If you’re counting or using the small end of numbers you might get that. Lower ordinal numbers appear more frequently for obvious reasons.

Sign in to participate in the conversation
Green Plenty

This is the companion community to the Green Plenty substack