Skip to content

Implement random() and friends

Peter Limkilde Svendsen requested to merge plimkilde/relibc:random into master

This MR implements random() and its associated functions, see https://pubs.opengroup.org/onlinepubs/9699919799.2018edition/functions/initstate.html. The code is a fairly direct port of musl's implementation and is tested against musl output.

I've gone through the implementation for integer size sanity but otherwise tried to preserve musl's behavior. However, the locking parts have not been ported over. Another possible issue is that user-supplied state arrays are not necessarily u32-aligned (might look into this later).

Merge request reports