php-internal-docs 8.4.8
Unofficial docs for php/php-src
Loading...
Searching...
No Matches
random.c File Reference
#include <stdlib.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <math.h>
#include "php.h"
#include "Zend/zend_attributes.h"
#include "Zend/zend_enum.h"
#include "Zend/zend_exceptions.h"
#include "php_random.h"
#include "php_random_csprng.h"
#include "ext/standard/sha1.h"
#include <sys/time.h>
#include "random_arginfo.h"

Go to the source code of this file.

Macros

#define PHP_COMBINED_LCG_MODMULT(a, b, c, m, s)
 

Functions

PHPAPI ZEND_DECLARE_MODULE_GLOBALS (random)
 
PHPAPI uint64_t php_random_range64 (php_random_algo_with_state engine, uint64_t umax)
 
PHPAPI voidphp_random_status_alloc (const php_random_algo *algo, const bool persistent)
 
PHPAPI voidphp_random_status_copy (const php_random_algo *algo, void *old_status, void *new_status)
 
PHPAPI void php_random_status_free (void *status, const bool persistent)
 
PHPAPI php_random_enginephp_random_engine_common_init (zend_class_entry *ce, zend_object_handlers *handlers, const php_random_algo *algo)
 
PHPAPI void php_random_engine_common_free_object (zend_object *object)
 
PHPAPI zend_objectphp_random_engine_common_clone_object (zend_object *object)
 
PHPAPI zend_long php_random_range (php_random_algo_with_state engine, zend_long min, zend_long max)
 
PHPAPI const php_random_algophp_random_default_algo (void)
 
PHPAPI voidphp_random_default_status (void)
 
 ZEND_SET_ALIGNED (16, static const char hexconvtab[])
 
PHPAPI zend_stringphp_random_bin2hex_le (const void *ptr, const size_t len)
 
PHPAPI bool php_random_hex2bin_le (zend_string *hexstr, void *dest)
 
PHPAPI double php_combined_lcg (void)
 
PHPAPI void php_mt_srand (uint32_t seed)
 
PHPAPI uint32_t php_mt_rand (void)
 
PHPAPI zend_long php_mt_rand_range (zend_long min, zend_long max)
 
PHPAPI zend_long php_mt_rand_common (zend_long min, zend_long max)
 
 PHP_FUNCTION (lcg_value)
 
 PHP_FUNCTION (mt_srand)
 
 PHP_FUNCTION (mt_rand)
 
 PHP_FUNCTION (mt_getrandmax)
 
 PHP_FUNCTION (rand)
 
 PHP_FUNCTION (random_bytes)
 
 PHP_FUNCTION (random_int)
 
PHPAPI uint64_t php_random_generate_fallback_seed_ex (php_random_fallback_seed_state *state)
 
PHPAPI uint64_t php_random_generate_fallback_seed (void)
 
 PHP_MINIT_FUNCTION (random)
 
 PHP_MSHUTDOWN_FUNCTION (random)
 
 PHP_RINIT_FUNCTION (random)
 

Variables

zend_module_entry random_module_entry
 

Macro Definition Documentation

◆ PHP_COMBINED_LCG_MODMULT

#define PHP_COMBINED_LCG_MODMULT ( a,
b,
c,
m,
s )
Value:
q = s / a; s = b * (s - a * q) - c * q; if (s < 0) s += m
char s[4]
Definition cdf.c:77
$obj a
Definition test.php:84

Function Documentation

◆ php_combined_lcg()

PHPAPI double php_combined_lcg ( void )

Definition at line 397 of file random.c.

◆ PHP_FUNCTION() [1/7]

PHP_FUNCTION ( lcg_value )

Definition at line 483 of file random.c.

◆ PHP_FUNCTION() [2/7]

PHP_FUNCTION ( mt_getrandmax )

Definition at line 549 of file random.c.

◆ PHP_FUNCTION() [3/7]

PHP_FUNCTION ( mt_rand )

Definition at line 524 of file random.c.

◆ PHP_FUNCTION() [4/7]

PHP_FUNCTION ( mt_srand )

Definition at line 492 of file random.c.

◆ PHP_FUNCTION() [5/7]

PHP_FUNCTION ( rand )

Definition at line 562 of file random.c.

◆ PHP_FUNCTION() [6/7]

PHP_FUNCTION ( random_bytes )

Definition at line 586 of file random.c.

◆ PHP_FUNCTION() [7/7]

PHP_FUNCTION ( random_int )

Definition at line 614 of file random.c.

◆ PHP_MINIT_FUNCTION()

PHP_MINIT_FUNCTION ( random )

Definition at line 729 of file random.c.

◆ PHP_MSHUTDOWN_FUNCTION()

PHP_MSHUTDOWN_FUNCTION ( random )

Definition at line 797 of file random.c.

◆ php_mt_rand()

PHPAPI uint32_t php_mt_rand ( void )

Definition at line 448 of file random.c.

◆ php_mt_rand_common()

PHPAPI zend_long php_mt_rand_common ( zend_long min,
zend_long max )

Definition at line 463 of file random.c.

◆ php_mt_rand_range()

PHPAPI zend_long php_mt_rand_range ( zend_long min,
zend_long max )

Definition at line 455 of file random.c.

◆ php_mt_srand()

PHPAPI void php_mt_srand ( uint32_t seed)

Definition at line 441 of file random.c.

◆ php_random_bin2hex_le()

PHPAPI zend_string * php_random_bin2hex_le ( const void * ptr,
const size_t len )

Definition at line 332 of file random.c.

◆ php_random_default_algo()

PHPAPI const php_random_algo * php_random_default_algo ( void )

Definition at line 306 of file random.c.

◆ php_random_default_status()

PHPAPI void * php_random_default_status ( void )

Definition at line 313 of file random.c.

◆ php_random_engine_common_clone_object()

PHPAPI zend_object * php_random_engine_common_clone_object ( zend_object * object)

Definition at line 277 of file random.c.

◆ php_random_engine_common_free_object()

PHPAPI void php_random_engine_common_free_object ( zend_object * object)

Definition at line 269 of file random.c.

◆ php_random_engine_common_init()

PHPAPI php_random_engine * php_random_engine_common_init ( zend_class_entry * ce,
zend_object_handlers * handlers,
const php_random_algo * algo )

Definition at line 253 of file random.c.

◆ php_random_generate_fallback_seed()

PHPAPI uint64_t php_random_generate_fallback_seed ( void )

Definition at line 716 of file random.c.

◆ php_random_generate_fallback_seed_ex()

PHPAPI uint64_t php_random_generate_fallback_seed_ex ( php_random_fallback_seed_state * state)

Definition at line 644 of file random.c.

◆ php_random_hex2bin_le()

PHPAPI bool php_random_hex2bin_le ( zend_string * hexstr,
void * dest )

Definition at line 358 of file random.c.

◆ php_random_range()

PHPAPI zend_long php_random_range ( php_random_algo_with_state engine,
zend_long min,
zend_long max )

Definition at line 293 of file random.c.

◆ php_random_range64()

PHPAPI uint64_t php_random_range64 ( php_random_algo_with_state engine,
uint64_t umax )

Definition at line 139 of file random.c.

◆ php_random_status_alloc()

PHPAPI void * php_random_status_alloc ( const php_random_algo * algo,
const bool persistent )

Definition at line 238 of file random.c.

◆ php_random_status_copy()

PHPAPI void * php_random_status_copy ( const php_random_algo * algo,
void * old_status,
void * new_status )

Definition at line 243 of file random.c.

◆ php_random_status_free()

PHPAPI void php_random_status_free ( void * status,
const bool persistent )

Definition at line 248 of file random.c.

◆ PHP_RINIT_FUNCTION()

PHP_RINIT_FUNCTION ( random )

Definition at line 806 of file random.c.

◆ ZEND_DECLARE_MODULE_GLOBALS()

PHPAPI ZEND_DECLARE_MODULE_GLOBALS ( random )

Definition at line 56 of file random.c.

◆ ZEND_SET_ALIGNED()

ZEND_SET_ALIGNED ( 16 ,
static const char hexconvtab[] )

Variable Documentation

◆ random_module_entry

zend_module_entry random_module_entry
Initial value:
= {
"random",
ext_functions,
PHP_MINIT(random),
PHP_MSHUTDOWN(random),
PHP_RINIT(random),
NULL,
NULL,
PHP_GINIT(random),
NULL,
NULL,
}
#define NULL
Definition gdcache.h:45
#define PHP_GINIT
Definition php.h:397
#define PHP_RINIT
Definition php.h:394
#define PHP_MSHUTDOWN
Definition php.h:393
#define PHP_MINIT
Definition php.h:392
#define PHP_MODULE_GLOBALS
Definition php.h:408
#define PHP_VERSION
Definition php_version.h:7
#define STANDARD_MODULE_HEADER
#define STANDARD_MODULE_PROPERTIES_EX

Definition at line 816 of file random.c.