Musl rand

Migrate to using musl functions for random number generation. Fixes issue #2341.