mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-12 13:38:21 +00:00
[Support] Add sys::Process::GetRandomNumber().
- Primitive API, but we rarely have need for random numbers. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@156237 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -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.
|
||||
|
Reference in New Issue
Block a user