Add Rand for nmat.