MCPcopy Create free account
hub / github.com/MultithreadedJSBook/code-samples / random64

Function random64

ch7-happycoin-as/happycoin.ts:5–8  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

3const randArr64 = new Uint64Array(1);
4const randArr8 = Uint8Array.wrap(randArr64.buffer, 0, 8); // <2>
5function random64(): u64 {
6 crypto.getRandomValues(randArr8); // <3>
7 return randArr64[0];
8}
9
10function sumDigitsSquared(num: u64): u64 {
11 let total: u64 = 0;

Callers 1

getHappycoinsFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected