Post

I do not know why a source control company needs to know about randomness but I am concerned. I shall be back when I read the article.

it’s not clear what the connection is between that and the slight probability imbalance of doing something like random_u64() % 10. the article is correct that random_u64() is almost never what you want but i don’t see how that difference matters all that much to fuzzing

It's more that we were reviewing our code, found this mistake, fixed it, and I decided to write about why it's a bad pattern. It isn't as if this magically unlocked something we didn't have, it's just musing on API design (I wrote the article and most of our Antithesis integration.)

0 reposts3 likes

In general people focus a lot on the minor probability skew in the u64 case (bigger skews happen in more controlled situations I've seen, people do make this same mistake even with rand_between on a small domain) but it's more about having an API that just lets you do the right thing from the start.

(The title was originally going to be much dryer/direct fwiw, something like "You should pretty much always use random_choice and not random_u64" but it's a bit of a mouthful and we waffled back and forth on it.)

having the right API is definitely a good thing, but the other part i’m a little confused about is, aren’t you using Rust? i thought rand (or the other alternatives) already provided the more useful APIs, so how’d you end up using random_u64() to begin with?

That could be more clear, yeah: antithesis provides their own Rust SDK that integrates with their platform, so that eg is derived from their platform hypervisor giving them more control over state space exploration. it provides all these APIs, we had just let random_u64 creep in