## Riga

i want to make program for a quiz.
i create the questions is an array,
and i want that questions start at random, and never be shown again.

``````dim question() as String = {"OTOMATIS MENURUT KERJA MESIN", "TIDAK MENEPATI JANJI", "YANG UTAMA", "TEMPAT TINGGAL KEPALA NEGARA", "PENGURUS RUMAH SAKIT",
"SUDAH PUAS MAKAN", "NEGARA INDUSTRI DI EROPA", "WILAYAH KEPULAUAN INDONESIA", "ILMU HUBUNGAN TIMBAL BALIK ANTARA MAKHLUK HIDUP DENGAN LINGKUNGANNYA",
"SIHIR(INGGRIS)"}``````

and after that what i have to do??

## __avd 1,826

Here is an algorithm.

To shuffle an array a of n elements:

``````for i from n − 1 downto 1 do
j ← random integer with 0 ≤ j ≤ i
exchange a[j] and a[i]``````

## Riga

Here is an algorithm.

To shuffle an array a of n elements:

``````for i from n − 1 downto 1 do
j ← random integer with 0 ≤ j ≤ i
exchange a[j] and a[i]``````

i still not understand, can i get more detail?

## __avd 1,826

i still not understand, can i get more detail?

``````Dim question() As String = {"OTOMATIS MENURUT KERJA MESIN", "TIDAK MENEPATI JANJI", "YANG UTAMA", "TEMPAT TINGGAL KEPALA NEGARA", "PENGURUS RUMAH SAKIT", "SUDAH PUAS MAKAN", "NEGARA INDUSTRI DI EROPA", "WILAYAH KEPULAUAN INDONESIA", "ILMU HUBUNGAN TIMBAL BALIK ANTARA MAKHLUK HIDUP DENGAN LINGKUNGANNYA", "SIHIR(INGGRIS)"}

Dim rnd As New Random
Dim index1, index2 As Integer
Dim tmp As String

For cnd As Integer = 1 To 5
'Obtain two random numbers betwee 0 to question.Length-1
index1 = rnd.Next(question.Length)
index2 = rnd.Next(question.Length)

'Swap string
tmp = question(index1)
question(index1) = question(index2)
question(index2) = tmp
Next``````

## Riga

thanks alot my friend
and because it's random some index shown again.
thanks again

## codeorder 197

See if this helps.

``````Dim rnd As New Random
MsgBox(question(rnd.Next(0, question.Length)))``````