changed getRandomValue() to getRandomIndex()