Tutorial Windows: Why Create and How to Use Random Numbers in Windows
It’s said that nothing ever happens for a reason, and yet, we rely on randomness of some facts for entertainment and even security. Computers can provide random sequence of characters through a complex algorithm, based on a seed.
Picking something at random involves making an unconscious decision from a pool of choices. Computers can’t really choose, since they only process human commands, but use advanced mathematical algorithms based on a variable seed, which can be time in milliseconds, that result in a different output almost, if not each time.
Randomness is encountered in many domains of activity. Some games completely rely on it, accounts might be distributed with random set of passwords, while most paid applications ask for a CD key, which is created with random characters, and more.
Generating a random number
In Microsoft Excel:
Step 1: Install Office if you haven’t already, and run Excel.
Step 2: Click on an empty cell, for instance A1.
Step 3: Use either the RAND or RANDBETWEEN formulas, as shown below:
|=RAND()||0.3213||0 to 1|
|=RAND()*10||3.123||0 to 10|
|=RAND()*(10-1)+1||7.234||1 to 10|
|=RAND()*100||54.2342||0 to 100|
|=RAND()*(100-1)+2||32.5432||1 to 100|
|=TRUNC(RAND()*(100-1)+2)||75||integers 1 to 100|
|=RANDBETWEEN(0-10)||3||integers 0 to 10|
|=RANDBETWEEN(50-9999)||432||integers 50 to 9999|
Note: Each time you finish editing a cell, a new random number is generated where the formula is written.
Hint: You can drag the bottom right corner of the cell across a large area to create a pattern of randomly-generated numbers that refresh every now and then.
Using third-party applications:
Step 1: Download and run Random Number Generator.
Step 2: Set minimum and maximum values for the generated interval. You can even use negative numbers.
Step 3 (optional): Specify number of digits to show and how many to generate.
Step 4: Press Generate Integers or Decimal Numbers. Results are enlisted in the right pane, with options to copy last one, all of them, or save the list to file.
Generating a CD Key
Using Microsoft Excel:
It’s not exactly a feature of Excel, but one of the many formula combinations you can use to your advantage. With this simple trick and the help of formulas above, you can create security keys of custom length and delimiters.
Step 1: Open up Microsoft Excel.
Step 2: Select an empty cell and fill it with this value:
=RANDBETWEEN(100,999)& " - " &RANDBETWEEN(100,999)
This creates a key with the length of two elements separated by a hyphen-minus, each containing three characters. (i.e: 321-453).
You can create as many elements as you want and can contain a custom number of characters. Here’s how combinations work:
-> (100,999) -> this is the pool of numbers to pick from. Left and right values determine lower and upper limits. The actual number of characters in each value determines the length of a key element. (100,999) – three elements, (1000,9999) – four elements.
-> =RANDBETWEEN(100,999)& -> this is always the start of the formula.
-> ” – ” &RANDBETWEEN(100,999)& ” – ” -> this always goes in the middle. The more of these you add, the more elements, but don’t forget about the first and last.
-> &RANDBETWEEN(100,999) -> this what you end your formula with.
-> “ – “ -> this is the delimiter used for elements. It contains two empty spaces and a hyphen in the middle. You can replace the hyphen with any other character to use as delimiter.
Note: Values change after each cell action, so you need to be careful how and where you save keys of interest.
Hint: Dragging the formula cell over more cells in that column creates multiple, different keys. Once you release the mouse button, press Ctrl + C to have all currently generated values saved.
Using third-party applications:
Step 1: Download and run Portable Abluescarab Software CD-Key Generator.
Step 2: Go to File and access Options.
Step 3: Choose to Save Generated Keys to Text File, and Enable Mass Generation.
Step 4 (optional): Set amount of sections and characters from the given drop-down menus.
Step 5: Press OK and hit Generate in the main window. A TXT file is created in the application directory.
Note: The advantage over Excel is that both numerical and alphabetical characters are used to generate keys, whereas the method above only uses numbers.