A computer program can use random numbers to add variability to game play.
For example, imagine if a deck of cards is always ordered the same, if you play a game with this deck, you'll eventually learn the order of the cards and be able to predict the next card coming up. Very handy in a casino, but really dull when playing a game for fun.
Now, computers do not have access to truly random numbers. What they do have is an algorithm for generating a sequence of pseudo-random numbers--that is, a series of numbers that appears to be random. Pseudo random number generators need 2 pieces of information to generate that series, a "seed" (a number that initiates the series), and the current state of the generator (on which the next number is based).
If you initiate the random generator with the same seed number a second time, the same series of random numbers is produced. That is why most games that need random numbers use the current timestamp as the seed. That way, the game varies every time you play it.
Some programs allow you to specify the seed value. This is often done for testing purposes as the series of random numbers can then be predicted.
In Visual Basic, you would typically initialize the random number with the current computer time by doing it this way:
VBMath.Randomize()
Or, to specify a specific seed, it would be done this way:
VBMath.Randomize(seed)
Now, I'm not sure what Attack From Mars does with the random numbers that are generated. I have noticed when playing the game that it starts with a random city each time. And, as you pointed out the random selection for Stroke of Luck. But, it's probably much more than that. You can't really look through the ROM, but you can look through the script for the Rnd() function and that should give you some idea of what they're used for.
By the way, in the ROM, it might (I'm not saying it does, but it MIGHT) use the value of 65535 as a special value meaning to seed the generator with the timestamp instead of the actual value.
Hope this helps.
Edited by BoltBait, 26 July 2019 - 12:44 AM.