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