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

Function getHappycoins

ch7-happycoin-as/happycoin.ts:31–40  ·  view source on GitHub ↗
(num: u32)

Source from the content-addressed store, hash-verified

29}
30
31export function getHappycoins(num: u32): Array<u64> {
32 const result = new Array<u64>();
33 for (let i: u32 = 1; i < num; i++) {
34 const randomNum = random64();
35 if (isHappycoin(randomNum)) {
36 result.push(randomNum);
37 }
38 }
39 return result;
40}

Callers

nothing calls this directly

Calls 2

random64Function · 0.70
isHappycoinFunction · 0.70

Tested by

no test coverage detected