I'm making a programme that creates a bingo card for 100 people and gives them all different numbers. but just now the code that i have is giving everyone the exact same 15 numbers. any help would be greatly appreciated, thanks.
Structure Number
Dim number As Integer
End Structure
Structure Player
Dim name As String
Dim numbers() As Number
Dim numbers_left As Integer
End Structure
Dim players As New List(Of Player)
Dim selectednumber As Integer
Dim used As New List(Of Integer)
Dim random As New Random
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim Number As Number
Dim player As Player
ReDim player.numbers(14)
For i = 1 To 100
For j = 0 To 14
SelectNumber: Number.number = random.Next(1, 101)
If player.numbers IsNot Nothing Then
For Each item In player.numbers
If item.number = Number.number Then
GoTo SelectNumber
End If
Next
End If
player.numbers(j).number = Number.number
Next
player.name = ("Bill" & i)
player.numbers_left = 15
players.Add(player)
Next
End Sub
Aucun commentaire:
Enregistrer un commentaire