Converting VBScript's Randomize Statement

Definition: Initializes the random-number generator.

Randomize

The Randomize statement (or its equivalent) is not required in Windows PowerShell. Instead, you can generate a random number using code similar to this:

$a = new-object random
$b = $a.next()

When you run this command and then echo back the value of $b you should back something similar to the following:

1558696419

Return to the VBScript to Windows PowerShell home page