I&#039m building a quiz that takes questions from a database. This seems to work fine, but now I want it to take random questions from the database so you get a slightly different quiz every time. However, sometimes the quiz asks the same question twice. I have added some code which takes note of the question number and checks this before it generates another random number, but it doesn&#039t work. I am completly stumped as to why it wont work!<BR>Can someone please help with this problem, here is the function that doesn&#039t do it&#039s job.....<BR>Function generatenumber(strarray)<BR>Dim Number<BR>Dim X<BR>Dim Y<BR> Y = Len(strarray) <BR><BR> randomize<BR> Number = Int((4 * rnd) + 1)<BR> Session("counter") = 1<BR><BR> for X = 1 to Y<BR> if (CStr(Mid(strarray, Session("counter") , 1))) = (CStr(Number)) then<BR> randomize<BR> Number = Int((4 * rnd) + 1)<BR> X = 0<BR> else<BR> Session("counter") = Session("counter") + 1<BR> end if<BR> next <BR><BR>generatenumber = Number<BR>End Function