32 s->state = php_random_uint128_add(
33 php_random_uint128_multiply(
s->state, php_random_uint128_constant(2549297995355413924ULL,4865540595714422341ULL)),
34 php_random_uint128_constant(6364136223846793005ULL,1442695040888963407ULL)
40 s->state = php_random_uint128_constant(0ULL, 0ULL);
42 s->state = php_random_uint128_add(
s->state, seed);
53 .size =
sizeof(uint64_t),
54 .
result = php_random_pcgoneseq128xslrr64_rotr64(
s->state),
72 u = php_random_uint128_hi(
s->state);
76 u = php_random_uint128_lo(
s->state);
90 if (zend_hash_num_elements(
data) != 2) {
94 for (uint32_t i = 0; i < 2; i++) {
103 s->state = php_random_uint128_constant(
u[0],
u[1]);
120 cur_mult = php_random_uint128_constant(2549297995355413924ULL,4865540595714422341ULL),
121 cur_plus = php_random_uint128_constant(6364136223846793005ULL,1442695040888963407ULL),
122 acc_mult = php_random_uint128_constant(0ULL, 1ULL),
123 acc_plus = php_random_uint128_constant(0ULL, 0ULL);
125 while (advance > 0) {
127 acc_mult = php_random_uint128_multiply(acc_mult, cur_mult);
128 acc_plus = php_random_uint128_add(php_random_uint128_multiply(acc_plus, cur_mult), cur_plus);
130 cur_plus = php_random_uint128_multiply(php_random_uint128_add(cur_mult, php_random_uint128_constant(0ULL, 1ULL)), cur_plus);
131 cur_mult = php_random_uint128_multiply(cur_mult, cur_mult);
135 state->state = php_random_uint128_add(php_random_uint128_multiply(acc_mult,
state->state), acc_plus);
146 bool seed_is_null =
true;
156 if (php_random_bytes_throw(&
s,
sizeof(
s)) ==
FAILURE) {
169 for (uint32_t i = 0; i < 2; i++) {
171 for (uint32_t
j = 0;
j < 8;
j++) {
172 t[i] += ((uint64_t) (
unsigned char)
ZSTR_VAL(str_seed)[(i * 8) +
j]) << (
j * 8);
PHPAPI void php_random_pcgoneseq128xslrr64_seed128(php_random_status_state_pcgoneseq128xslrr64 *s, php_random_uint128_t seed)
PHPAPI const php_random_algo php_random_algo_pcgoneseq128xslrr64
PHPAPI void php_random_pcgoneseq128xslrr64_advance(php_random_status_state_pcgoneseq128xslrr64 *state, uint64_t advance)
PHPAPI zend_string * php_random_bin2hex_le(const void *ptr, const size_t len)
PHPAPI bool php_random_hex2bin_le(zend_string *hexstr, void *dest)
struct _php_random_status_state_pcgoneseq128xslrr64 php_random_status_state_pcgoneseq128xslrr64
struct _php_random_algo_with_state php_random_algo_with_state
PHPAPI zend_class_entry * random_ce_Random_RandomException
#define Z_RANDOM_ENGINE_P(zval)
PHPAPI zend_long php_random_range(php_random_algo_with_state engine, zend_long min, zend_long max)
struct _php_random_algo php_random_algo
struct _php_random_result php_random_result
struct _php_random_uint128_t php_random_uint128_t
ZEND_API ZEND_COLD void zend_argument_value_error(uint32_t arg_num, const char *format,...)
#define ZEND_PARSE_PARAMETERS_END()
#define Z_PARAM_STR_OR_LONG_OR_NULL(dest_str, dest_long, is_null)
#define ZEND_PARSE_PARAMETERS_START(min_num_args, max_num_args)
#define Z_PARAM_LONG(dest)
ZEND_API ZEND_COLD zend_object * zend_throw_exception(zend_class_entry *exception_ce, const char *message, zend_long code)
ZEND_API zval *ZEND_FASTCALL zend_hash_next_index_insert(HashTable *ht, zval *pData)
ZEND_API zval *ZEND_FASTCALL zend_hash_index_find(const HashTable *ht, zend_ulong h)
struct _zend_string zend_string
#define UNEXPECTED(condition)
struct _zend_array HashTable
#define Z_STRLEN_P(zval_p)