gen rand part is revised.