[llvm] [libc][bazel] Add Bazel rules for rand/srand functions. (PR #159617)

via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 18 12:10:04 PDT 2025


lntue wrote:

> > If this is only for internal it would probably be better to make an internal randomness function that takes the state as an argument instead of it being a global. I already do that in a few places.
> 
> Good point. Yes, the file in question is `libc/test/src/math/FmaTest.h`, and I agree it's probably worth migrating it to internal RNG rather than use `LIBC_NAMESPACE::(s)rand` directly (you even had to fix it on GPU in [71ffc1f](https://github.com/llvm/llvm-project/commit/71ffc1f0ea1c64d475d9248ea7c68dfec16ee1ab)). I'll check w/ @lntue , but this can be done independently or rand/srand Bazel support.

Yes, we should definitely remove the `rand` from the tests' dependency.

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


More information about the llvm-commits mailing list