fixed the randdouble bug (But what was WRONG?)