~ knotless Search/
↑↓ move↵ open⇧↵ all results

spaces.cameron.stream/hello

Hello.

0
1
main
15 lines · 386 B Raw History
#include "fate.h"

static uint64_t mix(uint64_t x)
{
	x += 0x9e3779b97f4a7c15u;
	x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9u;
	x = (x ^ (x >> 27)) * 0x94d049bb133111ebu;
	return x ^ (x >> 31);
}

unsigned fate(uint64_t seed, long when, int question, unsigned sides)
{
	uint64_t asked = mix((uint64_t)when * 1000003u + (uint64_t)question);
	return (unsigned)(mix(seed ^ asked) % sides);
}