genrand part is revised.