@@ -124,34 +124,30 @@ extern zend_module_entry random_module_entry;
124
124
# define phpext_random_ptr &random_module_entry
125
125
126
126
extern PHPAPI zend_class_entry * random_ce_Random_Engine ;
127
- extern PHPAPI zend_class_entry * random_ce_Random_Engine_XorShift128Plus ;
128
- extern PHPAPI zend_class_entry * random_ce_Random_Engine_MersenneTwister ;
129
127
extern PHPAPI zend_class_entry * random_ce_Random_Engine_CombinedLCG ;
128
+ extern PHPAPI zend_class_entry * random_ce_Random_Engine_MersenneTwister ;
130
129
extern PHPAPI zend_class_entry * random_ce_Random_Engine_Secure ;
130
+ extern PHPAPI zend_class_entry * random_ce_Random_Engine_XorShift128Plus ;
131
+ extern PHPAPI zend_class_entry * random_ce_Random_Engine_Xoshiro256StarStar ;
131
132
extern PHPAPI zend_class_entry * random_ce_Random_Randomizer ;
132
133
133
- extern const php_random_engine_algo php_random_engine_algo_xorshift128plus ;
134
- extern const php_random_engine_algo php_random_engine_algo_mersennetwister ;
135
134
extern const php_random_engine_algo php_random_engine_algo_combinedlcg ;
135
+ extern const php_random_engine_algo php_random_engine_algo_mersennetwister ;
136
136
extern const php_random_engine_algo php_random_engine_algo_secure ;
137
137
extern const php_random_engine_algo php_random_engine_algo_user ;
138
+ extern const php_random_engine_algo php_random_engine_algo_xorshift128plus ;
139
+ extern const php_random_engine_algo php_random_engine_algo_xoshiro256starstar ;
138
140
139
141
typedef struct _php_random_engine {
140
142
const php_random_engine_algo * algo ;
141
143
void * state ;
142
144
zend_object std ;
143
145
} php_random_engine ;
144
146
145
- typedef struct _php_random_randomizer {
146
- const php_random_engine_algo * algo ;
147
- void * state ;
148
- bool self_allocate ;
149
- zend_object std ;
150
- } php_random_randomizer ;
151
-
152
- typedef struct _php_random_engine_state_xorshift128plus {
153
- uint64_t s [2 ];
154
- } php_random_engine_state_xorshift128plus ;
147
+ typedef struct _php_random_engine_state_combinedlcg {
148
+ int32_t s [2 ];
149
+ bool seeded ;
150
+ } php_random_engine_state_combinedlcg ;
155
151
156
152
typedef struct _php_random_engine_state_mersennetwister {
157
153
uint32_t s [MT_N ];
@@ -160,18 +156,28 @@ typedef struct _php_random_engine_state_mersennetwister {
160
156
bool seeded ;
161
157
} php_random_engine_state_mersennetwister ;
162
158
163
- typedef struct _php_random_engine_state_combinedlcg {
164
- int32_t s [2 ];
165
- bool seeded ;
166
- } php_random_engine_state_combinedlcg ;
167
-
168
159
typedef struct _php_random_engine_state_user {
169
160
zend_object * object ;
170
161
zend_function * size_method ;
171
162
zend_function * generate_method ;
172
163
size_t last_generate_size ;
173
164
} php_random_engine_state_user ;
174
165
166
+ typedef struct _php_random_engine_state_xorshift128plus {
167
+ uint64_t s [2 ];
168
+ } php_random_engine_state_xorshift128plus ;
169
+
170
+ typedef struct _php_random_engine_state_xoshiro256starstar {
171
+ uint64_t s [4 ];
172
+ } php_random_engine_state_xoshiro256starstar ;
173
+
174
+ typedef struct _php_random_randomizer {
175
+ const php_random_engine_algo * algo ;
176
+ void * state ;
177
+ bool self_allocate ;
178
+ zend_object std ;
179
+ } php_random_randomizer ;
180
+
175
181
static inline php_random_engine * php_random_engine_from_obj (zend_object * obj ) {
176
182
return (php_random_engine * )((char * )(obj ) - XtOffsetOf (php_random_engine , std ));
177
183
}
0 commit comments