fix bug with type 'random' in which.{min,max}2