1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
#include <pland/syscall.h> #include <pland/pcrt.h> #include <stdint.h> static uint32_t r; static void seed_rand() { r = _get_timestamp(); } BEFORE_MAIN(seed_rand) uint32_t gen_rand() { r ^= r << 13; r ^= r >> 17; r ^= r << 5; return r; }