summaryrefslogtreecommitdiff
path: root/xorshift.c
diff options
context:
space:
mode:
Diffstat (limited to 'xorshift.c')
-rw-r--r--xorshift.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/xorshift.c b/xorshift.c
index c11cc7a..ac4d087 100644
--- a/xorshift.c
+++ b/xorshift.c
@@ -22,14 +22,14 @@ __attribute__((visibility("default"))) bool initialize_states(){
errno = EIO;
return false;
}
- global_rng_state.state_idx = global_rng_state.states[7] & 0x0f;
+ global_rng_state.state_idx = global_rng_state.states[7] >> 28;
errno = 0;
return true;
}
__attribute__((visibility("default"))) uint32_t get_random_output(){
size_t use_state = global_rng_state.state_idx;
- global_rng_state.state_idx = global_rng_state.states[use_state] & 0x0f;
+ global_rng_state.state_idx = global_rng_state.states[use_state] >> 28;
if ( global_rng_state.gen_period_ctr >= 0xffffffff ){
global_rng_state.period_end_ctr++;
if ( global_rng_state.period_end_ctr >= 16 ){