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

Function random64

ch1-c-threads/happycoin.c:7–14  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5#include <time.h>
6
7uint64_t random64(uint32_t * seed) {
8 uint64_t result;
9 uint8_t * result8 = (uint8_t *)&result; // <1>
10 for (size_t i = 0; i < sizeof(result); i++) {
11 result8[i] = rand_r(seed);
12 }
13 return result;
14}
15
16uint64_t sum_digits_squared(uint64_t num) {
17 uint64_t total = 0;

Callers 1

mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected