php_mt_rand.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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. #ifndef PHP_MT_RAND_H
  24. #define PHP_MT_RAND_H
  25. #include "php_lcg.h"
  26. #include "php_rand.h"
  27. #define PHP_MT_RAND_MAX ((zend_long) (0x7FFFFFFF)) /* (1<<31) - 1 */
  28. #define MT_RAND_MT19937 0
  29. #define MT_RAND_PHP 1
  30. PHPAPI void php_mt_srand(uint32_t seed);
  31. PHPAPI uint32_t php_mt_rand(void);
  32. PHPAPI zend_long php_mt_rand_range(zend_long min, zend_long max);
  33. PHPAPI zend_long php_mt_rand_common(zend_long min, zend_long max);
  34. PHP_MINIT_FUNCTION(mt_rand);
  35. #endif /* PHP_MT_RAND_H */