Adding better randomisation code