Function Main As String
' Show random number generation

' THE EXAMPLE ILLUSTRATES THE USE OF:
'   Randomize
'   Rnd



Dim s,say,dcr As String, i,j,k,n As Integer, v,av As Double
Const title="SHOW RANDOM NUMBERS GENERATION"



  k=MBB_OK + MBI_INFORMATION
  dcr=Chr(13)+Chr(13)
  say="Next number within [0,1] is"+dcr

  Call Randomize
  For j=1 to 10
    v=Rnd
    i=MessageBox(say+Str(v), title, k)
  Next j
  i=MessageBox("Press OK to acquire a statistics for 1000 hops", title, MBB_OK + MBI_EXCLAMATION)
  n=1000
  av=0
  For j=1 to n
    v=Rnd
    av=av+v
  Next j
  av=av/Dbl(n)
  i=MessageBox("Average value is "+dcr+Str(av), title, k)

  Main="Demo completed"
End Function