changed rand functions for android