aboutsummaryrefslogtreecommitdiff
path: root/lib/Support/Process.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Support/Process.cpp')
-rw-r--r--lib/Support/Process.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/Support/Process.cpp b/lib/Support/Process.cpp
index 88ca7c3f22..c65cb45404 100644
--- a/lib/Support/Process.cpp
+++ b/lib/Support/Process.cpp
@@ -22,6 +22,15 @@ using namespace sys;
//=== independent code.
//===----------------------------------------------------------------------===//
+unsigned llvm::sys::Process::GetRandomNumber() {
+#if defined(HAVE_ARC4RANDOM)
+ return arc4random();
+#else
+ static int x = (::srand(::time(NULL)), 0);
+ return rand();
+#endif
+}
+
}
// Include the platform-specific parts of this class.