fixed warning/bug for double random generator