I am doing a loop and it's giving me a hard time. The result of this loop is the opposite of what I'm looking for. Here's the code:
I had to comment the Do While Loop out because it makes every card the same one. I have tried a lot of different ways to make it work but it never will. The goal is to make it keep generating random numbers until it's chosen a card that has not been chosen already.Code:<% Dim Suit Dim Value Dim numValue Dim intScore intScore = 0 Sub GetCards For x = 0 To 4 If Request.Form("Session" & x) <> "on" Then randomize() 'Do Until (randomNumber <> Session0) AND (randomNumber <> Session1) AND (randomNumber <> Session2) AND (randomNumber <> Session3) AND (randomNumber <> Session4) randomNumber=Int(51 * rnd()) 'Loop Session(x) = randomNumber Loop End If %>
Please tell me where I'm going wrong with this. Thank you.
If you know a better way to get this to work please tell me.




Reply With Quote