Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
_testRandom1() {
this.setState({randombytes_uniform:null})
let freq = [];
let p = []
for (i = 0; i < 256; ++i) freq[i] = 0;
for (i = 0; i < 20*256; ++i) p.push(Sodium.randombytes_uniform(256).then((v) => ++freq[v]))
Promise.all(p).then(() => {
var fail = false
for (i = 0; i < 256 && !fail; ++i) if (!freq[i]) fail = true
this.setState({randombytes_uniform:!fail})
})
}