summaryrefslogtreecommitdiff
path: root/ext/standard/php_random.h
diff options
context:
space:
mode:
authorLeigh <leigh@php.net>2016-10-19 18:00:54 +0100
committerLeigh <leigh@php.net>2016-10-20 10:18:07 +0100
commitc3361f16c7086d328142d4f08615e52256ad60df (patch)
tree774fd270da0a15a4ed2bfb46370b129ea5adf904 /ext/standard/php_random.h
parent9e480a1766f07193a795d29a646eda250fe2b7f4 (diff)
downloadphp-git-c3361f16c7086d328142d4f08615e52256ad60df.tar.gz
Add php_random_int internal API
This is the internal API compliment to `php_random_bytes`
Diffstat (limited to 'ext/standard/php_random.h')
-rw-r--r--ext/standard/php_random.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/ext/standard/php_random.h b/ext/standard/php_random.h
index c4034e7d8d..090e9d1dc4 100644
--- a/ext/standard/php_random.h
+++ b/ext/standard/php_random.h
@@ -34,7 +34,13 @@ typedef struct {
#define php_random_bytes_throw(b, s) php_random_bytes((b), (s), 1)
#define php_random_bytes_silent(b, s) php_random_bytes((b), (s), 0)
+#define php_random_int_throw(min, max, result) \
+ php_random_int((min), (max), (result), 1)
+#define php_random_int_silent(min, max, result) \
+ php_random_int((min), (max), (result), 0)
+
PHPAPI int php_random_bytes(void *bytes, size_t size, zend_bool should_throw);
+PHPAPI int php_random_int(zend_long min, zend_long max, zend_long *result, zend_bool should_throw);
#ifdef ZTS
# define RANDOM_G(v) ZEND_TSRMG(random_globals_id, php_random_globals *, v)