Nurutomo2

Minecraft Seed

Sep 13th, 2018
668
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. seed('2147483647');
  2.  
  3. function seed(str) {
  4.     // Minecraft Seed
  5.     var x = str.charCodeAt(0)*31 + str.charCodeAt(1)||str.charCodeAt(0)||Math.floor((Math.random()-0.5)*4294967296);
  6.     for (i = 1;i < str.length-1; i++) {
  7.         x = x*31 + str.charCodeAt(i+1);
  8.     }
  9.     return (/\d/.test(str))?(Number(str)>2147483646)?Number(str)-4294967295:Number(str):(x>2147483646)?x-4294967295:x;
  10. }
Advertisement
Add Comment
Please, Sign In to add comment