Advertisement
Guest User

Untitled

a guest
Oct 17th, 2019
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.23 KB | None | 0 0
  1. const getCryptoRandomValue = () => crypto.getRandomValues(new Uint32Array(1))[0]/Math.pow(2, 32);
  2. const getRandomArrayItem = a => a[getCryptoRandomValue()*a.length|0];
  3.  
  4. const array = [1,2,3,4,5;
  5. console.log(getRandomArrayItem(orderIds));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement