laarctags | new | comments | ask | show | place | submitlogin
Seeded random algorithm [JavaScript]
by laarc to ask pastebin 29 days ago | discuss

  // the initial seed
  Math.seed = 6;
  
  // in order to work 'Math.seed' must NOT be undefined,
  // so in any case, you HAVE to provide a Math.seed
  Math.seededRandom = function(max, min) {
      max = max || 1;
      min = min || 0;
  
      Math.seed = (Math.seed * 9301 + 49297) % 233280;
      var rnd = Math.seed / 233280;
  
      return min + rnd * (max - min);
  }
From: https://softwareengineering.stackexchange.com/questions/260969/original-source-of-seed-9301-49297-23...





Welcome | Guidelines | Bookmarklet | Feature Requests | Source | API | Contact | Twitter | Lists

RSS (stories) | RSS (comments)

Search: