@@ -79,6 +79,30 @@ u64 wpPrngXorshift256p(WpXor256State *state) {
|
||||
return result;
|
||||
}
|
||||
|
||||
u64 wpPrngXorshift256InRange(WpXor256State *state, u64 start, u64 end) {
|
||||
return wpPrngXorshift256(state) % (end - start) + start;
|
||||
}
|
||||
|
||||
u64 wpPrngXorshift256ssInRange(WpXor256State *state, u64 start, u64 end) {
|
||||
return wpPrngXorshift256ss(state) % (end - start) + start;
|
||||
}
|
||||
|
||||
u64 wpPrngXorshift256pInRange(WpXor256State *state, u64 start, u64 end) {
|
||||
return wpPrngXorshift256p(state) % (end - start) + start;
|
||||
}
|
||||
|
||||
u64 wpPrngXorshift256Choice(WpXor256State *state, u64 available_choices) {
|
||||
return wpPrngXorshift256(state) % available_choices;
|
||||
}
|
||||
|
||||
u64 wpPrngXorshift256ssChoice(WpXor256State *state, u64 available_choices) {
|
||||
return wpPrngXorshift256ss(state) % available_choices;
|
||||
}
|
||||
|
||||
u64 wpPrngXorshift256pChoice(WpXor256State *state, u64 available_choices) {
|
||||
return wpPrngXorshift256p(state) % available_choices;
|
||||
}
|
||||
|
||||
wp_intern u64 split_mix_64(SplitMix64State *state) {
|
||||
state->seed += 0x9E3779B97f4A7C15;
|
||||
|
||||
|
||||
@@ -23,6 +23,12 @@ WpXor256State wpPrngXorshiftInitWithSeed(u64 seed);
|
||||
u64 wpPrngXorshift256(WpXor256State *state);
|
||||
u64 wpPrngXorshift256ss(WpXor256State *state);
|
||||
u64 wpPrngXorshift256p(WpXor256State *state);
|
||||
u64 wpPrngXorshift256InRange(WpXor256State *state, u64 start, u64 end);
|
||||
u64 wpPrngXorshift256ssInRange(WpXor256State *state, u64 start, u64 end);
|
||||
u64 wpPrngXorshift256pInRange(WpXor256State *state, u64 start, u64 end);
|
||||
u64 wpPrngXorshift256Choice(WpXor256State *state, u64 available_choices);
|
||||
u64 wpPrngXorshift256ssChoice(WpXor256State *state, u64 available_choices);
|
||||
u64 wpPrngXorshift256pChoice(WpXor256State *state, u64 available_choices);
|
||||
|
||||
#ifdef WP_PLATFORM_CPP
|
||||
END_C_LINKAGE
|
||||
|
||||
Reference in New Issue
Block a user