Private Sub Application_Start (Nav As NavigationController)
NavControl = Nav
Page1.Initialize("Page1")
Page1.RootPanel.LoadLayout("1")
Nav.ShowPage(Page1)
Dim m As Map
m.Initialize
For i = 1 To 500
Dim res As Int = SecureRandomGenerator(-10, 10)
m.Put(res, m.GetDefault(res, 0) + 1)
Next
Log(m)
End Sub
Sub SecureRandomGenerator(Minimum As Int, Maximum As Int) As Int
Dim sr As SecureRandom
Dim data(4) As Byte
sr.GetRandomBytes(data)
Dim bc As ByteConverter
Dim random As Int = bc.IntsFromBytes(data)(0)
Maximum = Maximum - 1
Dim d As Double = random / 0x7FFFFFFF
Dim res As Int = Round(d * (Maximum - Minimum + 1) / 2 + (Minimum + Maximum) / 2)
'Log(res & ", " & random & ", " & d)
Return res
End Sub