Skip to content

Instantly share code, notes, and snippets.

@Dobby233Liu
Last active March 8, 2020 07:28
Show Gist options
  • Save Dobby233Liu/d1e9c24730fd996660890995f8138b14 to your computer and use it in GitHub Desktop.
Save Dobby233Liu/d1e9c24730fd996660890995f8138b14 to your computer and use it in GitHub Desktop.
random strangires for js [might update]
// random strangires based on Math.random [1, inefficine, unstable and wastes time]
Math_random1_part1=()=>Math.sinh(Math.cos(Math.atan(Math.tan(Math.random()*0.124231332135)))*0.252346/Math.LOG2E)%(+(new Date)/Math.LN2%Math.SQRT1_2*Math.E)/(Math.random()*0.043446566)*(Math.random()*0.0011124514%Math.random()+0.0011222)
Math_random1=()=>{
var m = Number(Math_random1_part1()).toString().split("");
var m2 = m.slice(2);
for (let i = m2.length - 1; i > 0; i--) {
const j = Math.floor(Math_random1_part1() * (i + 1));
[m2[i], m2[j]] = [m2[j], m2[i]];
}
var r=parseFloat(m[0]+m[1]+m2.join(""));
while(r>=1)r=r*(Math.random()*0.00124746863465)
return r
}
// simpler but dangerouser 1 [2]: use Math_random1_part1. note: it can flow to like 2
// hacky rng based on Math.random (max: depends on multipler) [3]
Math_random3_muitlpler=0.00043446566; //much more 0 before 4 bigger value
Math_random3=()=>Math.sinh(Math.cos(Math.atan(Math.tan(Math.random()*0.0124231332135)))*0.252346/Math.LOG2E)/(Math.random()*Math_random3_muitlpler)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment