summaryrefslogtreecommitdiff
path: root/uconfig.h
diff options
context:
space:
mode:
authorTony Cook <tony@develop-help.com>2013-09-09 14:44:57 +1000
committerTony Cook <tony@develop-help.com>2013-09-13 11:33:57 +1000
commit3be8f09452a42b9f1bbefef19be2dd11a2ca029b (patch)
treef7e06a8545aad7e0c2e96a680cebac9c06c4ff17 /uconfig.h
parente3be4e3ed79b466668bc99904a680772e8f04697 (diff)
downloadperl-3be8f09452a42b9f1bbefef19be2dd11a2ca029b.tar.gz
[perl #115928] a consistent (public) rand() implementation
Based on Yves's random branch work. This version makes the new random number visible to external modules, for example, List::Util's XS shuffle() implementation. I've also added a 64-bit implementation when HAS_QUAD is true, this should be significantly faster, even on 32-bit CPUs. This is intended to produce exactly the same sequence as the original implementation. The original version of this commit retained the "freebsd" name from Yves's original work for the function and data structure names. I've removed "freebsd" from most function names so the name isn't an issue if we choose to replace the implementation,
Diffstat (limited to 'uconfig.h')
-rw-r--r--uconfig.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/uconfig.h b/uconfig.h
index 2ae2ff2436..3e206dd291 100644
--- a/uconfig.h
+++ b/uconfig.h
@@ -3112,9 +3112,9 @@
* function used to generate normalized random numbers.
* Values include 15, 16, 31, and 48.
*/
-#define Drand01() ((rand() & 0x7FFF) / (double) ((unsigned long)1 << 15)) /**/
-#define Rand_seed_t int /**/
-#define seedDrand01(x) srand((Rand_seed_t)x) /**/
+#define Drand01() Perl_drand48() /**/
+#define Rand_seed_t U32 /**/
+#define seedDrand01(x) Perl_drand48_init((Rand_seed_t)x) /**/
#define RANDBITS 48 /**/
/* Select_fd_set_t:
@@ -4753,6 +4753,6 @@
#endif
/* Generated from:
- * 3631b2b781d1779dc1855cb35ab72d5176a9eb36a527f74231c7e3f274021182 config_h.SH
+ * eea5809659d1cac397ca3a1a48f51bcb5bfc60eb2dca2ef00b9b2015ee87729a config_h.SH
* 3dc6c26adfbf4f2e111d90b34d50e317e18555a76a270fbac2899d08a42f2fd1 uconfig.sh
* ex: set ro: */