You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

14 lines
310 B

import crypto from 'crypto';
export function crypto_random32() {
const arr = new Uint8Array(4);
const dataview = new DataView(arr.buffer);
crypto.getRandomValues(arr);
return dataview.getUint32(0);
}
export function fast_random32() {
return Math.floor(Math.random() * 4294967296);
}