Written by Ion Saliu on January 1, 2002 (2 WE).
Randomness or degree thereof is a lot more important than I thought previously. I always said that the Universe is the result of random interaction of forces. The differences are in the probabilities. No arguments there.
I am referring here to a down-to-earth form of randomness: random-generation in software.
I started years ago in this field. I posted previously on the topic. In 1985 I was working on a farm, in the same area I live now: South-Central Pennsylvania. Interesting farming! One of my colleagues had a home computer; I think it was a Vic-20. I was a computer buff myself, although did not possess a PC toy at that time. My colleague gave me the user's guide of his PC and asked me to write a program to generate lotto numbers! The booklet had a short presentation of the BASIC language built in the ROM chip. Interestingly, the random function was hardware-based! The program was ready in no time and we put it to work. The program was slow, although it was not using any filtering. The combinations generated that day had a very good statistical fluctuation. They either had no hits, or had two-three hits the following drawing. Even if the program had no paid winners, I liked its performance. It was after a few weeks that one of the combinations had '5 of 6' winners! I had no hesitation in enrolling a correspondence course in computer programming. The course offered also a computer (a tiny Sinclair) – the main reason I enrolled. Then I saw a deeply discounted price of an Atari 800 XL. I was on my way!
The 64 KB Atari allowed me to introduce filtering, albeit in a limited form. The main problem: the wonderful toy did not have a disk drive. I just couldn't find one. I even wrote to Atari Corporation. The disappointing answer was “product line discontinued”! Every time I wanted to run my program, I had to write it again, with all its filters! It was painstaking! The workaround was to leave the computer on for days. I wanted it on for weeks, but it was not possible. The electric bill was not a problem—the farm paid it. The consumption was negligible, nevertheless. The “problem” was an old chap, always in the mood of playing a practical joke. His name was Donald, an authentic joker. The old man was one of the owners of the farm. He had a garage right underneath my apartment. He would love to prank me. The frequency of his joking followed sophisticated rules of...randomness! I wouldn't be able to “predict” them! He would simply interrupt the electric power in his garage and my apartment as well. I was screaming, because I had to rewrite a painstaking computer program again and again... By the way, I also planted cantaloupes and raspberries in my front yard. Donald was the man in charge with mowing. He would also mow my cantaloupes and all my plants, randomly, of course! And he would laugh like crazy! Donald, may Almighty Number grant your atoms the most righteous flow in this comic Cosmos!
On February 12, 1986 WEB, my Atari 800 XL shocked the foundation of the RandomHouse. The program was running—uninterruptedly—for days. I stopped the program and selected 12-number combinations from the end of the run. The very last 12-number combination started with the 6 winners drawn in the PA lotto 6/40 ! The jackpot was over 3 million but we didn't play. I posted on the sad story last year.
The point I want to make here is the randomizing feature used by the early personal computers. They came bundled with the BASIC language. The programming language was not on a disk (software-based) but built-in ROM (hardware-based). I don't know the exact technical details. I read that the random function communicated directly with the chip quartz. I think it read directly the quartz frequency and used the value as a so-called random seed. The advantage of that technique is a wider variation in the seed value. Microsoft BASIC took control of the programming language in the early 1980's. It was bundled with IBM PC. The program was no longer in ROM, but on a disk. A solid programming platform, no doubt about that. The problem, from my perspective, was the introduction of software-based randomization. Some say it is pseudo-randomness. The software generates “random” numbers based on a “seed”, usually the timer. The timer counts the number of seconds since mid-night.
I noticed some anomalies in my ActiveX control that generated random combinations based on the timer. They showed “clumpness” quite often. That feature is a common fact at the blackjack tables when the game starts with a brand new deck of cards. The degree of randomness is very low, because the dealer doesn't have enough time to shuffle the deck thoroughly. The randomness is low, because it becomes predictable more often than not what streaks follow. A keen player will notice long streaks of like-cards: either low, or high cards. The longer the game goes, the higher the randomness will become. I compared also the roulette spins generated by my ActiveX control (created in Visual Basic) with real life spins. I also noticed more “clumpness” in the software-generated spins. I had only an explanation: the timer seed does not offer enough randomness. There are 86,400 seconds in a day. The variation is just too low by computer standards! I came up with a new randomizing function I will show at the end. Basically, it uses the date as a number. The function plays randomly with that number and the timer. The variation is far wider: from hundreds of thousands to billions. Now, there is something I can improve on. The new seed took very high values on December 31 (yesterday), but lower today, January 1st. I can think of other randomly varying...variables, such free memory and free disk space. The drawback is an increase in application size.
The new random function is implemented in version 5 of the ActiveX control. I like the results. I can see the results fall very consistently within the ranges of the normal probability rule. The easiest way to verify is the coin-tossing game. Write a simple text file named GAMES.1. The file has one line only:
Heads, Tails
(press Enter to end the line!)
Input that file in the “U.S. Bet” function. Go the end of file and see the statistical report. The binomial standard deviation in coin tossing is 5 in 100 trials.
Right now, I delayed “MDIEditor and Lotto WE” because I want to implement a better randomization function. Nik Barker did write a very good tutorial. It is comprehensive in its own right. It also offers pertinent links to additional information. Selecting strategies can go endlessly deeper and deeper. It can become an art of philosophical science of its own. The main thing is to just master the two basic principles. (Unfortunately, • Nik Kulai Barker turned out to be a spy for probably his own lotwin, a copycat of LotWon. Getting to know the algorithms and formulas and the source code of LotWon was Kulai's chief mission!)
"The Universe is the GamblingHouse where Almighty Number CreatesDestroys the EverythingNothing with the roll of the unbiased dice. May Its Random Almighty give us our consistent winning streak, in addition to our necessary losses. For the winner without a loss is like the horse without a wagon."
Here is the source code of the new randomizing function, TheSeeder(). You can set the random seed by a call to the function:
TheSeed = TheSeeder()
Randomize TheSeed
Public Function TheSeeder()
Dim TheSeed As Double
Dim Seed1 As Double
Dim Seed2 As Double
Dim This As String
Dim Num1 As Integer
Dim Num2 As Integer
Dim Num3 As Single
Randomize Timer
This = Format$(Date$, "dd/mm/yyyy")
Num1 = Val(Mid$(This, 1, 2))
Num2 = Val(Mid$(This, 4, 2))
Num3 = Val(Mid$(This, 7, 4))
Seed1 = (Int(Rnd * Num1) + 1) * (Int(Rnd * Num2 + 1) * (Int(Rnd * Num3 + 1) + 1)) 'Timer
Seed2 = (Int(Rnd * Seed1) + 1) * Seed1
TheSeed = Seed2 + (CDbl(Rnd * Timer + 1) * Int(Rnd * Num3 + Num2))
TheSeeder = TheSeed
End Function
See? This function is . . . public! Hopefully, others will improve it and make it public as well!
Related materials:
Resources in Theory of Probability, Mathematics, Statistics, Combinatorics, Software.
See a comprehensive directory of the pages and materials on the subject of theory of probability, mathematics, statistics, combinatorics, plus software.