B2G/gecko/browser/devtools/tilt/TiltWorkerCrafter.js
/**
   * From http://baagoe.com/en/RandomMusings/javascript
   * Johannes Baagoe <baagoe@baagoe.com>, 2010
   *
   * Seeds a random generator function with a set of passed arguments.
   */


Seeds a random generator function with a set of passed arguments.
Seeds a random generator function with a set of passed arguments .
function RNG_seed()
  {
    let s0 = 0;
    let s1 = 0;
    let s2 = 0;
    let c = 1;
    if (arguments.length === 0) {
      return this.seed(+new Date());
    } else {
      s0 = this.mash(" ");
      s1 = this.mash(" ");
      s2 = this.mash(" ");
      for (let i = 0, len = arguments.length; i < len; i++) {
        s0 -= this.mash(arguments[i]);
        if (s0 < 0) {
          s0 += 1;
        }
        s1 -= this.mash(arguments[i]);
        if (s1 < 0) {
          s1 += 1;
        }
        s2 -= this.mash(arguments[i]);
        if (s2 < 0) {
          s2 += 1;
        }
      }
      let random = function() {
        let t = 2091639 * s0 + c * 2.3283064365386963e-10; 
        s0 = s1;
        s1 = s2;
        return (s2 = t - (c = t | 0));
      };
      random.uint32 = function() {
        return random() * 0x100000000; 
      };
      random.fract53 = function() {
        return random() +
              (random() * 0x200000 | 0) * 1.1102230246251565e-16; 
      };
      return (this._generator = random);
    }
  }
function RNG_seed ( ) { let s0 = 0 ; let s1 = 0 ; let s2 = 0 ; let c = 1 ; if ( arguments . length === 0 ) { return this . seed ( + new Date ( ) ) ; } else { s0 = this . mash ( " " ) ; s1 = this . mash ( " " ) ; s2 = this . mash ( " " ) ; for ( let i = 0 , len = arguments . length ; i < len ; i ++ ) { s0 -= this . mash ( arguments [ i ] ) ; if ( s0 < 0 ) { s0 += 1 ; } s1 -= this . mash ( arguments [ i ] ) ; if ( s1 < 0 ) { s1 += 1 ; } s2 -= this . mash ( arguments [ i ] ) ; if ( s2 < 0 ) { s2 += 1 ; } } let random = function ( ) { let t = 2091639 * s0 + c * 2.3283064365386963e-10 ; s0 = s1 ; s1 = s2 ; return ( s2 = t - ( c = t | 0 ) ) ; } ; random . uint32 = function ( ) { return random ( ) * 0x100000000 ; } ; random . fract53 = function ( ) { return random ( ) + ( random ( ) * 0x200000 | 0 ) * 1.1102230246251565e-16 ; } ; return ( this . _generator = random ) ; } }
From http://baagoe.com/en/RandomMusings/javascript
 Johannes Baagoe <baagoe@baagoe.com>, 2010
From http : // baagoe . com / en / RandomMusings / javascript Johannes Baagoe <baagoe@baagoe . com > 2010
// 2^-32 // 2^32 // 2^-53