GNU MultiPrecision includes a random-number-generating sublibrary.
This includes a handful of wrapper functions converting the seed value from different types. Or calling methods. There's some global variables.
There's a routine which repeatedly generates numbers until its less than n, avoiding infinite loops. With a bitmask to improve odds.
There's an abstraction around selecting a randomness-formula, or another to set it.
1/3?