diff options
author | Michael Jones <michaelrj@google.com> | 2022-10-04 11:59:55 -0700 |
---|---|---|
committer | Michael Jones <michaelrj@google.com> | 2022-10-04 13:31:26 -0700 |
commit | 38b6f58e33bbd8dc0be570f41806d0a9006610d9 (patch) | |
tree | be624ff89eefbb0e10239b5daa4d6ffdd51f8148 /libc/src/stdlib/rand_util.cpp | |
parent | 42fead6834ef3a96c765ea545c2d2bac951f7e98 (diff) | |
download | llvm-38b6f58e33bbd8dc0be570f41806d0a9006610d9.zip llvm-38b6f58e33bbd8dc0be570f41806d0a9006610d9.tar.gz llvm-38b6f58e33bbd8dc0be570f41806d0a9006610d9.tar.bz2 |
[libc] implement basic rand and srand
This provides the reference implementation of rand and srand. In future
this will likely be upgraded to something that supports full ints.
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D135187
Diffstat (limited to 'libc/src/stdlib/rand_util.cpp')
-rw-r--r-- | libc/src/stdlib/rand_util.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/libc/src/stdlib/rand_util.cpp b/libc/src/stdlib/rand_util.cpp new file mode 100644 index 0000000..afa6662 --- /dev/null +++ b/libc/src/stdlib/rand_util.cpp @@ -0,0 +1,15 @@ +//===-- Shared utility for rand -------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#include "src/stdlib/rand_util.h" + +namespace __llvm_libc { + +thread_local unsigned long rand_next; + +} // namespace __llvm_libc |