The random number generator output taken over time demonstrates the generic f(x)=sin(x) graph. This implies that the "random" function is time based, and simply uses the current time as the random number. The wave behavior arises from the repetition of counting systems which clear and restart after a given time period. For instance in base 10:
1,2,3,4,5,6,7,8,9,,1,2,3,4,5,6,7,8,9... Would repeat causing a half wave function as shown above.
The Program, written in Visual Studio 2012 shown here in designer is backed by this code:Imports System.Text
Imports System.IO
Public Class Form1
Private Property File As StreamWriter
Sub Main()
Dim t As String = "0123456789"
Dim r As New Random
Dim s As New StringBuilder
For i As Integer = 1 To (1)
Dim idx As Integer = r.Next(0, 10)
s.Append(t.Substring(idx, 1))
Val.Text = s.ToString
File = My.Computer.FileSystem.OpenTextFileWriter("C:/Users/Desktop/9.txt", True)
File.WriteLine(Val.Text)
File.Close()
Next
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Main()
End Sub
End Class
Rather than use times simply holding the enter key constantly collects randgen output.
No comments:
Post a Comment