mercredi 5 février 2020

Random() doesn't seem to be so random at all

Random() doesn't seem to be so random at all, it keeps repeating the pattern all the time. How can I make this "more" random?

Dim ioFile As New System.IO.StreamReader("C:\names.txt")
    Dim lines As New List(Of String)
    Dim rnd As New Random()
    Dim line As Integer
    While ioFile.Peek <> -1
        lines.Add(ioFile.ReadLine())
    End While
    line = rnd.Next(lines.Count + 0)
    NAMES.AppendText(lines(line).Trim())
    ioFile.Close()
    ioFile.Dispose()
    Clipboard.SetText(NAMES.Text)



Aucun commentaire:

Enregistrer un commentaire