PDA

View Full Version : how to generate random numbers


darshu
03-16-2005, 06:47 AM
hi guys,
i hav no. of questions in the database.i have to distribute these questions to the students in random order.the number of questions in the question paper varies.please send me the coding for this.we hav to do this in frontend "asp" or at the backend "oracle 9i".please help me...

ghell
03-16-2005, 09:16 AM
heres a function to generate a random number between 2 points, inclusive

Function RandomNumber(intMin, intMax)
Randomize
If intMin <= intMax Then
RandomNumber = Int(intMin + Rnd*(Abs(intMax - intMin) + 1))
Else
RandomNumber = Int(intMax + Rnd*(Abs(intMax - intMin) + 1))
End If
End Functionto make it run in a random number, get it to choose questions like this and make sure one hasnt already been taken. For the different amount of questions, just loop a different amount of times around this depending on the number of questions