aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Support/Unix
diff options
context:
space:
mode:
authorNAKAMURA Takumi <geek4civic@gmail.com>2012-05-06 08:24:18 +0000
committerNAKAMURA Takumi <geek4civic@gmail.com>2012-05-06 08:24:18 +0000
commit24cddd5c9a7622e06e7ae0e0887e5e0d48326606 (patch)
treead95b55a65631b7018c5dd62c021ff7ee0ed5e6d /lib/Support/Unix
parent77eafd940a2fcbecbd82e1a649b7f081cb4a3d4a (diff)
downloadexternal_llvm-24cddd5c9a7622e06e7ae0e0887e5e0d48326606.zip
external_llvm-24cddd5c9a7622e06e7ae0e0887e5e0d48326606.tar.gz
external_llvm-24cddd5c9a7622e06e7ae0e0887e5e0d48326606.tar.bz2
Support/Process: Move llvm::sys::Process::GetRandomNumber() from Process.cpp to Unix/Process.inc.
FIXME: GetRandomNumber() is not implemented in Win32. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@156251 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Support/Unix')
-rw-r--r--lib/Support/Unix/Process.inc9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/Support/Unix/Process.inc b/lib/Support/Unix/Process.inc
index f640462..de98262 100644
--- a/lib/Support/Unix/Process.inc
+++ b/lib/Support/Unix/Process.inc
@@ -297,3 +297,12 @@ const char *Process::OutputReverse() {
const char *Process::ResetColor() {
return "\033[0m";
}
+
+unsigned llvm::sys::Process::GetRandomNumber() {
+#if defined(HAVE_ARC4RANDOM)
+ return arc4random();
+#else
+ static int x = (::srand(::time(NULL)), 0);
+ return ::rand();
+#endif
+}