xref: /PHP-8.1/ext/standard/php_mt_rand.h (revision 01b3fc03)
1 /*
2    +----------------------------------------------------------------------+
3    | Copyright (c) The PHP Group                                          |
4    +----------------------------------------------------------------------+
5    | This source file is subject to version 3.01 of the PHP license,      |
6    | that is bundled with this package in the file LICENSE, and is        |
7    | available through the world-wide-web at the following url:           |
8    | https://www.php.net/license/3_01.txt                                 |
9    | If you did not receive a copy of the PHP license and are unable to   |
10    | obtain it through the world-wide-web, please send a note to          |
11    | license@php.net so we can mail you a copy immediately.               |
12    +----------------------------------------------------------------------+
13    | Authors: Rasmus Lerdorf <rasmus@php.net>                             |
14    |          Zeev Suraski <zeev@php.net>                                 |
15    |          Pedro Melo <melo@ip.pt>                                     |
16    |          Sterling Hughes <sterling@php.net>                          |
17    |                                                                      |
18    | Based on code from: Shawn Cokus <Cokus@math.washington.edu>          |
19    +----------------------------------------------------------------------+
20  */
21 
22 #ifndef PHP_MT_RAND_H
23 #define PHP_MT_RAND_H
24 
25 #include "php_lcg.h"
26 #include "php_rand.h"
27 
28 #define PHP_MT_RAND_MAX ((zend_long) (0x7FFFFFFF)) /* (1<<31) - 1 */
29 
30 #define MT_RAND_MT19937 0
31 #define MT_RAND_PHP 1
32 
33 PHPAPI void php_mt_srand(uint32_t seed);
34 PHPAPI uint32_t php_mt_rand(void);
35 PHPAPI zend_long php_mt_rand_range(zend_long min, zend_long max);
36 PHPAPI zend_long php_mt_rand_common(zend_long min, zend_long max);
37 
38 PHP_MINIT_FUNCTION(mt_rand);
39 
40 #endif	/* PHP_MT_RAND_H */
41