atriusmaps-node-sdk
Version:
This project provides an API to Atrius Personal Wayfinder maps within a Node environment. See the README.md for more information
2 lines (1 loc) • 658 B
JavaScript
const t="test"===import.meta.env?.MODE?(n=12345678,function(){let t=n+=1831565813;return t=Math.imul(t^t>>>15,1|t),t^=t+Math.imul(t^t>>>7,61|t),((t^t>>>14)>>>0)/4294967296}):Math.random;var n;const o=(n,o)=>(null==o&&(o=n,n=0),Math.floor(t()*(o-n)+n));function e(t,n){n||(n=t),t>n&&(t=n);const e=[];if(t/n<.3){const r=new Set;for(;e.length<t;){const t=o(n);r.has(t)||(r.add(t),e.push(t))}}else{const r=Array.from({length:n},(t,n)=>n);for(let s=0;s<t;s++){const t=o(n-s);e.push(r[t]),r[t]=r[n-s-1]}}return e}const r=(t,n)=>n.map(n=>t[n]),s=t=>r(t,e(t.length)),l=(t,n=1)=>r(t,e(n,t.length));export{l as arrayPick,o as rand,e as randomSet,s as randomizeArray};