Issue: 14.4 (July/August 2016)
Author: Marc Zeedar
Author Bio: Marc taught himself programming in high school when he bought his first computer but had no money for software. He's had fun learning ever since.
Article Description: ription>No description av
Article Length (in bytes): 12,101
Starting Page Number: eN
Article Number: 14408
project-14408.zip Updated: 2016-07-04 14:35:28
Related Link(s): None
Excerpt of article text...
In last issue's
Beginner's CornerI wrote about obfuscation and in that I talked a little about randomization. It occurs to me that I've never written about randomization in xDevand that it's an important topic that is often tricky for beginners.
In the old days, back when I started programming computers in high school, we only had the
rndcommand. It returns a random number between 0 and 1. Since most of the time you wanted a whole number—say, to represent the roll of a die in a game—you then had to multiply the
rndresult and round up to produce a number in the range you wanted.
// Die roll using rnd.
dim dieRoll as integer = round(rnd * 6)
...End of Excerpt. Please purchase the magazine to read the full article.