blob: a3298a9f25e66ff7740afc845a0927aa249f8b56 [file] [log] [blame]
#include "igt_rand.h"
static uint32_t state = 0x12345678;
uint32_t
hars_petruska_f54_1_random_seed(uint32_t new_state)
{
uint32_t old_state = state;
state = new_state;
return old_state;
}
uint32_t
hars_petruska_f54_1_random_unsafe(void)
{
#define rol(x,k) ((x << k) | (x >> (32-k)))
return state = (state ^ rol (state, 5) ^ rol (state, 24)) + 0x37798849;
#undef rol
}