Array API: port the RNG functions
Is Your Feature Request Related to a Problem? Please Describe
As identified in #383. These are non-trivial as the Array API doesn't appear to plan to have a unified random number generation scheme https://github.com/data-apis/array-api/issues/431. The only effort of an underlying API has been SPEC 7.
- Ideally, we want something that supports
numpy.random↔jax.random - Seems easier to port JAX to NumPy
- Best to have a NumPy interface as most users will be using CPU
Describe the Solution You'd Like
No response
Describe Alternatives You've Considered
No response
Additional Context
No response
Working on a proof-of-concept random API wrapper for JAX in https://github.com/glass-dev/jrng.
While not a general solution (see discussion at data-apis/array-api#874) the implementation at https://github.com/glass-dev/rng-jax seems to work well in the GLASS situation where a rng object is passed into Python code. So we could start working on that.
Looking at this now 👀
some more discussion at https://github.com/data-apis/array-api-extra/issues/308 (we are also planning to discuss this in the community meeting tomorrow)
Thanks for the heads-up @lucascolley! Given the time in the UK, I'm afraid I won't be able to make it to the community meeting. But we definitely have a need to generate random numbers from simple distributions (like what numpy.random.Generator offers) in an array-backend-agnostic manner, and we had to come up with our own solutions for that.
This has been completed now, closing