/php-src/ext/random/ |
H A D | randomizer.c | 37 randomizer->engine = engine->engine; in randomizer_common_init() 41 randomizer->engine = (php_random_algo_with_state){ in randomizer_common_init() 58 randomizer->is_userland_algo = true; in randomizer_common_init() 89 randomizer_common_init(randomizer, Z_OBJ_P(&engine)); in PHP_METHOD() 97 php_random_algo_with_state engine = randomizer->engine; in PHP_METHOD() 214 php_random_algo_with_state engine = randomizer->engine; in PHP_METHOD() 235 php_random_algo_with_state engine = randomizer->engine; in PHP_METHOD() 278 php_random_algo_with_state engine = randomizer->engine; in PHP_METHOD() 400 randomizer->engine, in PHP_METHOD() 554 …zengine = zend_read_property(randomizer->std.ce, &randomizer->std, "engine", strlen("engine"), 1, … in PHP_METHOD() [all …]
|
/php-src/ext/random/tests/03_randomizer/ |
H A D | engine_unsafe_biased.phpt | 17 function randomizer(): Randomizer 23 var_dump(randomizer()->getInt(0, 1234)); 29 var_dump(randomizer()->nextInt()); 35 var_dump(bin2hex(randomizer()->getBytes(1))); 41 var_dump(randomizer()->shuffleArray(range(1, 1234))); 47 var_dump(randomizer()->pickArrayKeys(range(1, 1234), 1)); 53 var_dump(randomizer()->pickArrayKeys(range(1, 1234), 10)); 59 var_dump(randomizer()->shuffleBytes('foobar')); 65 var_dump(randomizer()->getBytesFromString('123', 10)); 71 var_dump(randomizer()->getBytesFromString(str_repeat('a', 500), 10));
|
H A D | engine_unsafe_empty_string.phpt | 17 function randomizer(): Randomizer 23 var_dump(randomizer()->getInt(0, 1234)); 29 var_dump(randomizer()->nextInt()); 35 var_dump(bin2hex(randomizer()->getBytes(1))); 41 var_dump(randomizer()->shuffleArray(range(1, 1234))); 47 var_dump(randomizer()->pickArrayKeys(range(1, 1234), 1)); 53 var_dump(randomizer()->pickArrayKeys(range(1, 1234), 10)); 59 var_dump(randomizer()->shuffleBytes('foobar')); 65 var_dump(randomizer()->getBytesFromString('123', 10)); 71 var_dump(randomizer()->getBytesFromString(str_repeat('a', 500), 10));
|
H A D | construct_twice.phpt | 21 $randomizer = new Randomizer(new Xoshiro256StarStar()); 22 $randomizer->__construct(new PcgOneseq128XslRr64()); 28 $randomizer = new Randomizer(new TestShaEngine("1234")); 29 $randomizer->__construct(new TestShaEngine("1234")); 35 $randomizer = new Randomizer(new Xoshiro256StarStar()); 36 $randomizer->__construct(new TestShaEngine("1234")); 41 var_dump($randomizer->engine::class);
|
H A D | engine_unsafe_nul.phpt | 17 function randomizer(): Randomizer 23 var_dump(randomizer()->getInt(0, 1234)); 29 var_dump(randomizer()->nextInt()); 35 var_dump(bin2hex(randomizer()->getBytes(1))); 41 var_dump(randomizer()->shuffleArray(range(1, 123))); 47 var_dump(randomizer()->pickArrayKeys(range(1, 123), 1)); 53 var_dump(randomizer()->pickArrayKeys(range(1, 123), 10)); 59 var_dump(randomizer()->shuffleBytes('foobar')); 65 var_dump(randomizer()->getBytesFromString('123', 10)); 71 var_dump(randomizer()->getBytesFromString(str_repeat('a', 500), 10));
|
H A D | compatibility_array_rand.phpt | 20 $randomizer = new Randomizer(new Mt19937(1234)); 22 [$mapPickOneMethod] = $randomizer->pickArrayKeys($map, 1); 23 $mapPickTwoMethod = $randomizer->pickArrayKeys($map, 2); 25 [$listPickOneMethod] = $randomizer->pickArrayKeys($list, 1); 26 $listPickTwoMethod = $randomizer->pickArrayKeys($list, 2);
|
H A D | compatibility_mt_rand.phpt | 11 $randomizer = new Randomizer(new Mt19937(1234, MT_RAND_PHP)); 15 if ($randomizer->nextInt() !== mt_rand()) { 21 if ($randomizer->getInt(0, $i) !== mt_rand(0, $i)) { 28 $randomizer = new Randomizer(new Mt19937(1234, MT_RAND_MT19937)); 32 if ($randomizer->nextInt() !== mt_rand()) { 38 if ($randomizer->getInt(0, $i) !== mt_rand(0, $i)) {
|
H A D | readonly.phpt | 10 $randomizer = new Randomizer(new PcgOneseq128XslRr64(1234)); 14 $randomizer->engine = new Xoshiro256StarStar(1234); 20 if ($randomizer->getInt(0, $i) !== $referenceRandomizer->getInt(0, $i)) {
|
H A D | serialize.phpt | 26 $randomizer = new Randomizer($engine); 29 $randomizer->getInt(0, $i); 32 $randomizer2 = unserialize(serialize($randomizer)); 35 if ($randomizer->getInt(0, $i) !== $randomizer2->getInt(0, $i)) {
|
H A D | engine_unsafe_exits.phpt | 17 $randomizer = new Randomizer(new ExitingEngine()); 19 var_dump($randomizer->getBytes(1));
|
H A D | engine_unsafe_throws.phpt | 17 $randomizer = new Randomizer(new ThrowingEngine()); 19 var_dump($randomizer->getBytes(1));
|
/php-src/ext/random/tests/03_randomizer/methods/ |
H A D | getInt_gh9415.phpt | 9 $randomizer = new Randomizer(new Mt19937(1234)); 11 var_dump($randomizer->getInt(-2147483648, 2147483647)); 13 $randomizer = new Randomizer(new Mt19937(4321)); 14 var_dump($randomizer->getInt(-2147483648, 2147483647));
|
H A D | pickArrayKeys_error.phpt | 8 function randomizer(): Randomizer 14 var_dump(randomizer()->pickArrayKeys("foo", 2)); 20 var_dump(randomizer()->pickArrayKeys([], 0)); 26 var_dump(randomizer()->pickArrayKeys(range(1, 3), 0)); 32 var_dump(randomizer()->pickArrayKeys(range(1, 3), -1)); 38 var_dump(randomizer()->pickArrayKeys(range(1, 3), 10));
|
H A D | getBytes_expansion.phpt | 28 $randomizer = new Randomizer(new TestEngine()); 31 var_dump($randomizer->getBytes(5)); 34 var_dump($randomizer->getBytes(11)); 37 var_dump($randomizer->getBytes(7));
|
H A D | getBytesFromString_error.phpt | 8 function randomizer(): Randomizer 14 var_dump(randomizer()->getBytesFromString("", 2)); 20 var_dump(randomizer()->getBytesFromString("abc", 0));
|
H A D | getFloat_error.phpt | 9 function randomizer(): Randomizer 23 var_dump(randomizer()->getFloat(NAN, 0.0, $boundary)); 29 var_dump(randomizer()->getFloat(INF, 0.0, $boundary)); 35 var_dump(randomizer()->getFloat(-INF, 0.0, $boundary)); 41 var_dump(randomizer()->getFloat(0.0, NAN, $boundary)); 47 var_dump(randomizer()->getFloat(0.0, INF, $boundary)); 53 var_dump(randomizer()->getFloat(0.0, -INF, $boundary)); 59 var_dump(randomizer()->getFloat(0.0, -0.1, $boundary)); 65 var_dump(randomizer()->getFloat(0.0, 0.0, $boundary)); 72 … var_dump(randomizer()->getFloat(100_000_000_000_000_000.0, 100_000_000_000_000_000.1, $boundary)); [all …]
|
H A D | getBytesFromString.phpt | 28 $randomizer = new Randomizer($engine); 29 var_dump($randomizer->getBytesFromString('a', 10)); 30 var_dump($randomizer->getBytesFromString(str_repeat('a', 256), 5)); 33 $output = $randomizer->getBytesFromString(str_repeat('ab', $i), 500);
|
H A D | nextInt_64_engine_on_32_platform.phpt | 11 $randomizer = new Randomizer(new Xoshiro256StarStar()); 14 var_dump($randomizer->nextInt());
|
H A D | getInt_expansion_32.phpt | 19 $randomizer = new Randomizer(new ByteEngine()); 21 var_dump(bin2hex(pack('V', $randomizer->getInt(0, 0x00FF_FFFF))));
|
H A D | getInt_expansion_64.phpt | 21 $randomizer = new Randomizer(new ByteEngine()); 23 var_dump(bin2hex(pack('P', $randomizer->getInt(0, 0x00FF_FFFF_FFFF_FFFF))));
|
H A D | getInt.phpt | 28 $randomizer = new Randomizer($engine); 32 $result = $randomizer->getInt(-$i, $i); 41 $randomizer->getInt(PHP_INT_MIN, PHP_INT_MAX);
|
H A D | pickArrayKeys.phpt | 40 $randomizer = new Randomizer($engine); 43 $result = $randomizer->pickArrayKeys($array1, $i); 53 $result = $randomizer->pickArrayKeys($array2, $i); 63 $result = $randomizer->pickArrayKeys($array3, $i);
|
H A D | nextInt.phpt | 27 $randomizer = new Randomizer($engine); 31 $randomizer->nextInt();
|
H A D | nextFloat.phpt | 28 $randomizer = new Randomizer($engine); 32 $result = $randomizer->nextFloat();
|
H A D | getBytes.phpt | 29 $randomizer = new Randomizer($engine); 32 if (\strlen($randomizer->getBytes($i)) !== $i) {
|