xref: /PHP-7.1/ext/standard/php_mt_rand.h (revision 03f3b847)
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@zend.com>                                |
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 /* $Id$ */
24 
25 #ifndef PHP_MT_RAND_H
26 #define PHP_MT_RAND_H
27 
28 #include "php_lcg.h"
29 #include "php_rand.h"
30 
31 #define PHP_MT_RAND_MAX ((zend_long) (0x7FFFFFFF)) /* (1<<31) - 1 */
32 
33 #define MT_RAND_MT19937 0
34 #define MT_RAND_PHP 1
35 
36 PHPAPI void php_mt_srand(uint32_t seed);
37 PHPAPI uint32_t php_mt_rand(void);
38 PHPAPI zend_long php_mt_rand_range(zend_long min, zend_long max);
39 PHPAPI zend_long php_mt_rand_common(zend_long min, zend_long max);
40 
41 PHP_MINIT_FUNCTION(mt_rand);
42 
43 #endif	/* PHP_MT_RAND_H */
44