Added helper genererateRandomArray