$87 GRAYBYTE WORDPRESS FILE MANAGER $93

SERVER : vnpttt-amd7f72-h1.vietnix.vn #1 SMP Fri May 24 12:42:50 UTC 2024
SERVER IP : 103.200.23.149 | ADMIN IP 216.73.216.22
OPTIONS : CRL = ON | WGT = ON | SDO = OFF | PKEX = OFF
DEACTIVATED : NONE

/opt/alt/php72/usr/include/php/ext/standard/

HOME
Current File : /opt/alt/php72/usr/include/php/ext/standard//php_rand.h
/*
   +----------------------------------------------------------------------+
   | PHP Version 7                                                        |
   +----------------------------------------------------------------------+
   | Copyright (c) 1997-2018 The PHP Group                                |
   +----------------------------------------------------------------------+
   | This source file is subject to version 3.01 of the PHP license,      |
   | that is bundled with this package in the file LICENSE, and is        |
   | available through the world-wide-web at the following url:           |
   | http://www.php.net/license/3_01.txt                                  |
   | If you did not receive a copy of the PHP license and are unable to   |
   | obtain it through the world-wide-web, please send a note to          |
   | license@php.net so we can mail you a copy immediately.               |
   +----------------------------------------------------------------------+
   | Authors: Rasmus Lerdorf <rasmus@php.net>                             |
   |          Zeev Suraski <zeev@zend.com>                                |
   |          Pedro Melo <melo@ip.pt>                                     |
   |          Sterling Hughes <sterling@php.net>                          |
   |                                                                      |
   | Based on code from: Shawn Cokus <Cokus@math.washington.edu>          |
   +----------------------------------------------------------------------+
 */
/* $Id$ */

#ifndef PHP_RAND_H
#define	PHP_RAND_H

#include "php_lcg.h"
#include "php_mt_rand.h"

/* System Rand functions */
#ifndef RAND_MAX
#define RAND_MAX PHP_MT_RAND_MAX
#endif

#define PHP_RAND_MAX PHP_MT_RAND_MAX

/*
 * A bit of tricky math here.  We want to avoid using a modulus because
 * that simply tosses the high-order bits and might skew the distribution
 * of random values over the range.  Instead we map the range directly.
 *
 * We need to map the range from 0...M evenly to the range a...b
 * Let n = the random number and n' = the mapped random number
 *
 * Then we have: n' = a + n(b-a)/M
 *
 * We have a problem here in that only n==M will get mapped to b which
 # means the chances of getting b is much much less than getting any of
 # the other values in the range.  We can fix this by increasing our range
 # artificially and using:
 #
 #               n' = a + n(b-a+1)/M
 *
 # Now we only have a problem if n==M which would cause us to produce a
 # number of b+1 which would be bad.  So we bump M up by one to make sure
 # this will never happen, and the final algorithm looks like this:
 #
 #               n' = a + n(b-a+1)/(M+1)
 *
 * -RL
 */
#define RAND_RANGE_BADSCALING(__n, __min, __max, __tmax) \
	(__n) = (__min) + (zend_long) ((double) ( (double) (__max) - (__min) + 1.0) * ((__n) / ((__tmax) + 1.0)))

#define RAND_RANGE(__n, __min, __max, __tmax) \
	(__n) = php_mt_rand_range((__min), (__max))

#ifdef PHP_WIN32
#define GENERATE_SEED() (((zend_long) (time(0) * GetCurrentProcessId())) ^ ((zend_long) (1000000.0 * php_combined_lcg())))
#else
#define GENERATE_SEED() (((zend_long) (time(0) * getpid())) ^ ((zend_long) (1000000.0 * php_combined_lcg())))
#endif

PHPAPI void php_srand(zend_long seed);
PHPAPI zend_long php_rand(void);

#endif	/* PHP_RAND_H */

Current_dir [ NOT WRITEABLE ] Document_root [ WRITEABLE ]


[ Back ]
NAME
SIZE
LAST TOUCH
USER
CAN-I?
FUNCTIONS
..
--
13 Aug 2025 1.54 AM
root / 996
0755
base64.h
1.925 KB
9 Jul 2025 2.57 PM
root / 996
0644
basic_functions.h
7.55 KB
9 Jul 2025 2.57 PM
root / 996
0644
crc32.h
4.78 KB
9 Jul 2025 2.57 PM
root / 996
0644
credits.h
1.686 KB
9 Jul 2025 2.57 PM
root / 996
0644
credits_ext.h
5.372 KB
9 Jul 2025 2.57 PM
root / 996
0644
credits_sapi.h
0.825 KB
9 Jul 2025 2.57 PM
root / 996
0644
crypt_blowfish.h
1.023 KB
9 Jul 2025 2.57 PM
root / 996
0644
crypt_freesec.h
0.649 KB
9 Jul 2025 2.57 PM
root / 996
0644
css.h
1.205 KB
9 Jul 2025 2.57 PM
root / 996
0644
cyr_convert.h
1.236 KB
9 Jul 2025 2.57 PM
root / 996
0644
datetime.h
1.354 KB
9 Jul 2025 2.57 PM
root / 996
0644
dl.h
1.604 KB
9 Jul 2025 2.57 PM
root / 996
0644
exec.h
1.692 KB
9 Jul 2025 2.57 PM
root / 996
0644
file.h
4.693 KB
9 Jul 2025 2.57 PM
root / 996
0644
flock_compat.h
2.07 KB
9 Jul 2025 2.57 PM
root / 996
0644
fsock.h
1.572 KB
9 Jul 2025 2.57 PM
root / 996
0644
head.h
1.804 KB
9 Jul 2025 2.57 PM
root / 996
0644
html.h
2.635 KB
9 Jul 2025 2.57 PM
root / 996
0644
html_tables.h
472.423 KB
9 Jul 2025 2.57 PM
root / 996
0644
info.h
22.611 KB
9 Jul 2025 2.57 PM
root / 996
0644
md5.h
2.112 KB
9 Jul 2025 2.57 PM
root / 996
0644
microtime.h
1.333 KB
9 Jul 2025 2.57 PM
root / 996
0644
pack.h
1.249 KB
9 Jul 2025 2.57 PM
root / 996
0644
pageinfo.h
1.435 KB
9 Jul 2025 2.57 PM
root / 996
0644
php_array.h
4.378 KB
9 Jul 2025 2.57 PM
root / 996
0644
php_assert.h
1.396 KB
9 Jul 2025 2.57 PM
root / 996
0644
php_browscap.h
1.296 KB
9 Jul 2025 2.57 PM
root / 996
0644
php_crypt.h
1.622 KB
9 Jul 2025 2.57 PM
root / 996
0644
php_crypt_r.h
2.004 KB
9 Jul 2025 2.57 PM
root / 996
0644
php_dir.h
1.674 KB
9 Jul 2025 2.57 PM
root / 996
0644
php_dns.h
2.889 KB
9 Jul 2025 2.57 PM
root / 996
0644
php_ext_syslog.h
1.476 KB
9 Jul 2025 2.57 PM
root / 996
0644
php_filestat.h
3.107 KB
9 Jul 2025 2.57 PM
root / 996
0644
php_fopen_wrappers.h
1.927 KB
9 Jul 2025 2.57 PM
root / 996
0644
php_ftok.h
1.234 KB
9 Jul 2025 2.57 PM
root / 996
0644
php_http.h
1.752 KB
9 Jul 2025 2.57 PM
root / 996
0644
php_image.h
2.38 KB
9 Jul 2025 2.57 PM
root / 996
0644
php_incomplete_class.h
2.248 KB
9 Jul 2025 2.57 PM
root / 996
0644
php_iptc.h
1.243 KB
9 Jul 2025 2.57 PM
root / 996
0644
php_lcg.h
1.496 KB
9 Jul 2025 2.57 PM
root / 996
0644
php_link.h
1.339 KB
9 Jul 2025 2.57 PM
root / 996
0644
php_mail.h
2.384 KB
9 Jul 2025 2.57 PM
root / 996
0644
php_math.h
4.658 KB
9 Jul 2025 2.57 PM
root / 996
0644
php_metaphone.h
1.213 KB
9 Jul 2025 2.57 PM
root / 996
0644
php_mt_rand.h
1.967 KB
9 Jul 2025 2.57 PM
root / 996
0644
php_password.h
1.865 KB
9 Jul 2025 2.57 PM
root / 996
0644
php_rand.h
3.246 KB
9 Jul 2025 2.57 PM
root / 996
0644
php_random.h
2.123 KB
9 Jul 2025 2.57 PM
root / 996
0644
php_smart_string.h
1.282 KB
9 Jul 2025 2.57 PM
root / 996
0644
php_smart_string_public.h
1.289 KB
9 Jul 2025 2.57 PM
root / 996
0644
php_standard.h
2.303 KB
9 Jul 2025 2.57 PM
root / 996
0644
php_string.h
6.021 KB
9 Jul 2025 2.57 PM
root / 996
0644
php_type.h
1.603 KB
9 Jul 2025 2.57 PM
root / 996
0644
php_uuencode.h
1.46 KB
9 Jul 2025 2.57 PM
root / 996
0644
php_var.h
3.26 KB
9 Jul 2025 2.57 PM
root / 996
0644
php_versioning.h
1.373 KB
9 Jul 2025 2.57 PM
root / 996
0644
proc_open.h
1.746 KB
9 Jul 2025 2.57 PM
root / 996
0644
quot_print.h
1.463 KB
9 Jul 2025 2.57 PM
root / 996
0644
scanf.h
2.254 KB
9 Jul 2025 2.57 PM
root / 996
0644
sha1.h
1.7 KB
9 Jul 2025 2.57 PM
root / 996
0644
streamsfuncs.h
2.874 KB
9 Jul 2025 2.57 PM
root / 996
0644
uniqid.h
1.243 KB
9 Jul 2025 2.57 PM
root / 996
0644
url.h
2.342 KB
9 Jul 2025 2.57 PM
root / 996
0644
url_scanner_ex.h
2.452 KB
9 Jul 2025 2.57 PM
root / 996
0644
winver.h
6.228 KB
9 Jul 2025 2.57 PM
root / 996
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2026 CONTACT ME
Static GIF