On Saturday, 3 August 2019 at 16:35:34 UTC, Giovanni Di Maria wrote:
Do you know other faster functions or methods to generate random numbers?

For me the "goodness of random" is NOT important.

I found some nice random functions in this public-domain C single-header library collection, one of which is GameRand:


Here's the D version:
struct GameRand
        uint[2] state;

uint randomGameRand(ref GameRand gamerand) {
gamerand.state[0] = ( gamerand.state[0] << 16 ) + ( gamerand.state[0] >> 16 );
    gamerand.state[0] += gamerand.state[1];
    gamerand.state[1] += gamerand.state[0];
    return gamerand.state[0];

It's really fast and decent enough for games (hence the name I suppose). See:

Reply via email to