Home
last modified time | relevance | path

Searched refs:randomizer (Results 1 – 25 of 31) sorted by relevance

12

/php-src/ext/random/
H A Drandomizer.c37 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 Dengine_unsafe_biased.phpt17 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 Dengine_unsafe_empty_string.phpt17 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 Dconstruct_twice.phpt21 $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 Dengine_unsafe_nul.phpt17 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 Dcompatibility_array_rand.phpt20 $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 Dcompatibility_mt_rand.phpt11 $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 Dreadonly.phpt10 $randomizer = new Randomizer(new PcgOneseq128XslRr64(1234));
14 $randomizer->engine = new Xoshiro256StarStar(1234);
20 if ($randomizer->getInt(0, $i) !== $referenceRandomizer->getInt(0, $i)) {
H A Dserialize.phpt26 $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 Dengine_unsafe_exits.phpt17 $randomizer = new Randomizer(new ExitingEngine());
19 var_dump($randomizer->getBytes(1));
H A Dengine_unsafe_throws.phpt17 $randomizer = new Randomizer(new ThrowingEngine());
19 var_dump($randomizer->getBytes(1));
/php-src/ext/random/tests/03_randomizer/methods/
H A DgetInt_gh9415.phpt9 $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 DpickArrayKeys_error.phpt8 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 DgetBytes_expansion.phpt28 $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 DgetBytesFromString_error.phpt8 function randomizer(): Randomizer
14 var_dump(randomizer()->getBytesFromString("", 2));
20 var_dump(randomizer()->getBytesFromString("abc", 0));
H A DgetFloat_error.phpt9 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 DgetBytesFromString.phpt28 $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 DnextInt_64_engine_on_32_platform.phpt11 $randomizer = new Randomizer(new Xoshiro256StarStar());
14 var_dump($randomizer->nextInt());
H A DgetInt_expansion_32.phpt19 $randomizer = new Randomizer(new ByteEngine());
21 var_dump(bin2hex(pack('V', $randomizer->getInt(0, 0x00FF_FFFF))));
H A DgetInt_expansion_64.phpt21 $randomizer = new Randomizer(new ByteEngine());
23 var_dump(bin2hex(pack('P', $randomizer->getInt(0, 0x00FF_FFFF_FFFF_FFFF))));
H A DgetInt.phpt28 $randomizer = new Randomizer($engine);
32 $result = $randomizer->getInt(-$i, $i);
41 $randomizer->getInt(PHP_INT_MIN, PHP_INT_MAX);
H A DpickArrayKeys.phpt40 $randomizer = new Randomizer($engine);
43 $result = $randomizer->pickArrayKeys($array1, $i);
53 $result = $randomizer->pickArrayKeys($array2, $i);
63 $result = $randomizer->pickArrayKeys($array3, $i);
H A DnextInt.phpt27 $randomizer = new Randomizer($engine);
31 $randomizer->nextInt();
H A DnextFloat.phpt28 $randomizer = new Randomizer($engine);
32 $result = $randomizer->nextFloat();
H A DgetBytes.phpt29 $randomizer = new Randomizer($engine);
32 if (\strlen($randomizer->getBytes($i)) !== $i) {

Completed in 33 milliseconds

12