Added implementation for rand_r()

stdlib.h doesn't implement rand_r() on Android.