[libc-commits] [libc] [libc] Change rand implementation so all tests pass in both 32- and 64-bit systems (PR #98692)

Schrodinger ZHU Yifan via libc-commits libc-commits at lists.llvm.org
Fri Jul 12 20:48:12 PDT 2024


================
@@ -13,20 +13,33 @@
 
 namespace LIBC_NAMESPACE {
 
-// An implementation of the xorshift64star pseudo random number generator. This
+// An implementation of the xorshift* pseudo random number generator. This
 // is a good general purpose generator for most non-cryptographics applications.
-LLVM_LIBC_FUNCTION(int, rand, (void)) {
+static inline unsigned long xorshiftstar(unsigned long a, unsigned long b,
----------------
SchrodingerZhu wrote:

For C++, having `static` is fine, no need to add `inline` inside `src.cpp`.

https://github.com/llvm/llvm-project/pull/98692


More information about the libc-commits mailing list