>I have a piece of code where I generate a random number between 1 and n. You're running Linux, I presume? You want to try (random () % 24) + 1 ? This should also tell you the index in the array. Venkatesh -- Venkatesha Murthy G. http://www.ciol.com/content/services/forum/