how can you randomize an array?
Console.WriteLine("program is running")
Dim name(9) As String
Dim counter As Integer
Randomize()
For counter = 0 To 9
Console.WriteLine("enter your name" * counter)
name(counter) = Console.ReadLine
Next
Console.WriteLine("your names have been randomized")
Console.ReadLine()
here is my code i need to randomize the ten names and display them, i tried everything but i can't randomize them, please help!!
1
Expert's answer
2012-12-06T09:50:17-0500
Module Module1
Sub Main()
Dim name(9) As String For i = 0 To 8 Console.WriteLine("enter your name " + (i + 1).ToString() + ": ") name(i) = Console.ReadLine Next Console.WriteLine("your names have been randomized") Dim random As New Random()
For i = 0 To 8 Dim number = random.Next(0, 8) Console.WriteLine(name(number)) Next
Comments
Leave a comment