UNPKG

@animech-public/playcanvas

Version:
2 lines (1 loc) 704 B
import{math as t}from"./math.js";const r=2.399963229728653,s={circlePoint(t){const r=Math.sqrt(Math.random()),s=2*Math.random()*Math.PI;t.x=r*Math.cos(s),t.y=r*Math.sin(s)},circlePointDeterministic(t,s,a){const i=s*r,n=Math.sqrt(s)/Math.sqrt(a);t.x=n*Math.cos(i),t.y=n*Math.sin(i)},spherePointDeterministic(s,a,i,n=0,e=1){n=1-2*n,e=1-2*e;const h=t.lerp(n,e,a/i),o=Math.sqrt(1-h*h),c=r*a;s.x=Math.cos(c)*o,s.y=h,s.z=Math.sin(c)*o},radicalInverse(t){let r=(t<<16|t>>>16)>>>0;return r=((1431655765&r)<<1|(2863311530&r)>>>1)>>>0,r=((858993459&r)<<2|(3435973836&r)>>>2)>>>0,r=((252645135&r)<<4|(4042322160&r)>>>4)>>>0,r=((16711935&r)<<8|(4278255360&r)>>>8)>>>0,2.3283064365386963e-10*r}};export{s as random};