Skip to content

Add reentrant random functions from LSB

George Matsumura requested to merge Gorg/gcompat:reentrant_random into current

This adds random_r(), initstate_r(), srandom_r, and setstate_r(), which were required by a few glibc-linked binaries I found. In these changes, I tried to make mostly complete implementations which work according to how they were intended in the specification, although I wasn't able to rigorously test them. It is mostly adapted/copied from musl's random() implementation. If dummy implementations that do not use the state table and that are based on other random functions like rand_r() or erand48() are preferable, please let me know and I can try to change my submission.

Thank you for looking at this, as well as for any reply.

Signed-off-by: George Matsumura gm960420@ohio.edu

Merge request reports