I ran the following thinBasic program, and the output was, 29,994,029.
That seems pretty good, since, perfection would be, 30,000,000.
(Apparently, the generated distribution is very close to uniform, so that the statement, "If Rnd <= 0.3", should be true, almost exactly 30% of the time.)
Dan
Uses "console"
Global i, c As Long
Function TBMain()
' Seed the random number generator using the number of elapsed seconds since midnight.
Randomize
' (To instead make a reproducible sequence, use a constant seed, like, "Randomize(2)".)
' (Note that, "Randomize()", produces the same sequence as, "Randomize(0)".)
c = 0
' Generate 100,000,000 extended precision random values, and determine how many are less than or equal to 0.3.
For i = 1 To 100000000
If Rnd <= 0.3 Then c += 1
Next
Console_WriteLine(c)
WaitKey
End Function
Bookmarks