Hi;
I need help woth random number generation. I am developing a game show which has more than 100 questions and for each question there are 4 options. I am using a random function which ranomizes the value of t (row value of database). But the problem is that I can't stop the duplication, I have used the standard rndm function with lower and upper bound values and have also used randomize funtion for generating a different question every time game show starts.
t = Int((50 - 1) * Rnd() + 1)
t= 50 in this case, i.e. 50 rows have data and I want to randomize this data such that 50 questions are answered but with random order of questions. Below is the code where image and text file are imported from access db.
Dim adp As New OleDbDataAdapter("select * from tb1 where [QID]=" + t.ToString(), con)
Dim ds As New DataSet
adp.Fill(ds)
Dim dt As DataTable
dt = ds.Tables(0)
qbox.Text = dt.Rows(0).Item(1)
PictureBox1.ImageLocation = dt.Rows(0).Item(2)
PictureBox2.ImageLocation = dt.Rows(0).Item(3)
PictureBox3.ImageLocation = dt.Rows(0).Item(4)
PictureBox4.ImageLocation = dt.Rows(0).Item(5)
con.Close()
Can I use a counter with a value set to 50 and then rduce the count by 1 to get exact 50 questions.
Any help would be appreciated.