[libc] implement basic rand and srand
authorMichael Jones <michaelrj@google.com>
Tue, 4 Oct 2022 18:59:55 +0000 (11:59 -0700)
committerMichael Jones <michaelrj@google.com>
Tue, 4 Oct 2022 20:31:26 +0000 (13:31 -0700)
commit38b6f58e33bbd8dc0be570f41806d0a9006610d9
treebe624ff89eefbb0e10239b5daa4d6ffdd51f8148
parent42fead6834ef3a96c765ea545c2d2bac951f7e98
[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
16 files changed:
libc/config/linux/x86_64/entrypoints.txt
libc/include/CMakeLists.txt
libc/include/llvm-libc-macros/CMakeLists.txt
libc/include/llvm-libc-macros/stdlib-macros.h [new file with mode: 0644]
libc/include/stdlib.h.def
libc/spec/spec.td
libc/spec/stdc.td
libc/src/stdlib/CMakeLists.txt
libc/src/stdlib/rand.cpp [new file with mode: 0644]
libc/src/stdlib/rand.h [new file with mode: 0644]
libc/src/stdlib/rand_util.cpp [new file with mode: 0644]
libc/src/stdlib/rand_util.h [new file with mode: 0644]
libc/src/stdlib/srand.cpp [new file with mode: 0644]
libc/src/stdlib/srand.h [new file with mode: 0644]
libc/test/src/stdlib/CMakeLists.txt
libc/test/src/stdlib/rand_test.cpp [new file with mode: 0644]