bug fix duplicate rand