pike.git
/
src
/
builtin.cmod
version
»
Context lines:
10
20
40
80
file
none
3
pike.git/src/builtin.cmod:1365:
*! This function returns a random number in the range 0 - @[max]-1. *! *! @seealso *! @[random_seed()] */ PMOD_EXPORT PIKEFUN int random(int i) { if(i <= 0) RETURN 0;
-
#
ifdef
AUTO_BIGNUM
+
#
if
defined (
AUTO_BIGNUM
) && SIZEOF_INT_TYPE > 4
if(i >> 31) { unsigned INT_TYPE a = my_rand(); unsigned INT_TYPE b = my_rand(); RETURN (INT_TYPE)(((a<<32)|b) % i); } #endif RETURN my_rand() % i; } PMOD_EXPORT