[libc-commits] [libc] [libc] Improve the implementation of the rand() function (PR #66131)
via libc-commits
libc-commits at lists.llvm.org
Tue Sep 12 13:06:21 PDT 2023
================
@@ -14,11 +14,18 @@
#include <stdlib.h>
TEST(LlvmLibcRandTest, UnsetSeed) {
+ static int vals[1000];
+
for (size_t i = 0; i < 1000; ++i) {
int val = __llvm_libc::rand();
ASSERT_GE(val, 0);
ASSERT_LE(val, RAND_MAX);
+ vals[i] = val;
}
+
+ __llvm_libc::srand(1);
----------------
lntue wrote:
Can you add comment about the C standard from `rand_util.cpp` here to explain why we are testing this value?
https://github.com/llvm/llvm-project/pull/66131
More information about the libc-commits
mailing list