Export (0) Print
Expand All
Expand Minimize
This topic has not yet been rated - Rate this topic

Converting VBScript's Randomize Statement


Windows PowerShell


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

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.