Fix for Android before 5.0: the rand() function is not defined and lrand48() needs to be used instead.