php_mt_rand.h 1.8 KB

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