# Romu – Fine random number generators, Hacker News

Test suites: PractRand BigCrush (in TestU

Popular generators: Lagged Fibonacci Blackman-Vigna LCG PCG Mersenne Twister

What is Romu?

Romu is a new family of random-number generators that match the statistical quality (randomness) of the best popular generators, but are faster. In fact, due to the processor’s ILP (explained below), Romu generators add () delay to an application when inlined. In effect, Romu generators are infinitely fast when inlined. And they’re very fast when not inlined.

Such speed and high quality are possible because Romu generators are nonlinear, unlike most popular generators. A Romu generator combines the linear operation of multiplication with the nonlinear operation of rotation, yielding better randomness at higher speed.

You can learn all the details about Romu generators in the paper . Although this is a formal academic paper, the math in it isn’t overwhelming because it’s at the level of advanced algebra (except for one integral). The math derives equations for probabilities of trouble, such as the snowflake probability described next.

One Snowflake in History

Above, we mentioned that Romu generators are nonlinear. There is a reason people have avoided nonlinear generators in the past: Unlike a linear generator, a nonlinear generator does not have one cycle that covers all possible internal state-values. Instead, it gives you a random permutation of those values. Random permutations are known to consist of multiple cycles of random lengths. In the past, when generators stored their state in one – bit variable, these random cycle -lengths would cause users to sometimes encounter cycles that were too short. That problem eliminated nonlinear generators from consideration.

But nowadays, processors can easily handle – bit variables , and having two or three such variables In the generator’s state is no problem, which makes encountering a too-short cycle all but impossible. For example, if you gave RomuTrio (with (bits of state) the impossibly large job of outputting 2

## )

and also randomly selecting the Queen of England out of all of Earth’s population (2

## What do you think?

GIPHY App Key not set. Please check settings