import * as seedRandom from "seedrandom" ; const DEFAULT_SEED = 0 ; /**
 * Representation for random number generator with mutable state.
 */ export interface IRandomNumberGenerator { /**
     * Generate a new number, increment state
     */ get ( ) : number ; param seed setSeed ( seed ) : void ; /**
     * Restore original seed (default seed if none was given).
     */ restore ( ) : void ; } const createSeedRandom = ( seed ? ) : seedrandom . prng => { return seedRandom ( ( seed && seed . toString ( ) ) || DEFAULT_SEED . toString ( ) ) ; } ; param seed export const randomNumberGenerator = ( { seed , } ) : IRandomNumberGenerator => { let rng = createSeedRandom ( seed ) ; return { get ( ) { return rng ( ) ; } , setSeed ( newSeed ) { rng = createSeedRandom ( newSeed ) ; return this ; } , restore ( ) { rng = createSeedRandom ( seed ) ; return this ; } , } ; } ;