madCode
madCode

Reputation: 3903

Random Number Generation in least computation time

Can someone suggest an algorithm to find a random number within say a limit 'n', that could be computed in least computation time?

Upvotes: 3

Views: 147

Answers (1)

Raymond Hettinger
Raymond Hettinger

Reputation: 226296

The Complementary-Multiply-with-Carry random number generator has a long period and with comparatively simple update operations. It strikes a nice balance between speed and quality.

To see some working code, there is a Python recipe for CMC.

Upvotes: 3

Related Questions