[llvm] [libc][bazel] Add Bazel rules for rand/srand functions. (PR #159617)
Alexey Samsonov via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 18 14:01:31 PDT 2025
vonosmas 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.
Do you think we should just move the current `rand()` implementation to somewhere like `libc/src/__support/random.h` , so that we can use it both in `rand()` implementation and in unit tests that need randomness?
https://github.com/llvm/llvm-project/pull/159617
More information about the llvm-commits
mailing list