If I'm correctly understanding your question, then you can use:

int index = (int)(Math.random() * 5);

Normally, Math.random() will select random numbers from 0 to as close to 1 as possible...