Re: Seeding Randomization on CMD (WinXP Pro)

From: Mark V (notvalid_at_nul.invalid)
Date: 10/06/04


Date: Wed, 06 Oct 2004 00:16:53 -0700

In microsoft.public.win2000.cmdprompt.admin PsyB wrote:

> Can anyone tell me how to get a *PROPER* random number? I have
> defined a variable as follows:
>
> set randnumber=%random%
>
> When querying the contents of my variable %randnumber% when
> staying inside the CMD prompt without an exit, the variable, of
> course, is randomized. However since my script takes exactly the
> same amount of time to run each time it is run, the random number
> will always be the same since the %random% variable is never
> seeded properly (indeed it follows the same progression of
> "random" numbers each and every time that CMD is started). I have
> tried various way to cause inconsistency in how fast the script is
> executed including netstat, ping and dir - anything that might
> change the execution time so that the number pulled from the pool
> is different, though no matter what I have tried I end up
> centering around a single number. Is there any way to generate a
> real random number on CMD? Or is there any way to seed the CMD
> line with the time or some other variable that would allow a
> better randomization? Use of pause is out of the question, though,
> as this needs to be a transparent script.

All I can offer is this:
http://www.optimumx.com/
=================
 Random Number Generator v1.00 (Random.exe) Last Updated:
09/03/1998

Returns an exit code (Errorlevel) of a pseudo-random number based on
lowerbound and upperbound numbers passed as arguments. The number
returned is much more random than the %RANDOM% variable. Use
'Random.exe /?' to view the syntax."
=================

I have used it for years but can only say that it is *more* random
than %random%. I have no statistical study for the tool.



Relevant Pages

  • Re: Seeding Randomization on CMD (WinXP Pro)
    ... > that CMD is started). ... > how fast the script is executed including netstat, ... > anything that might change the execution time so that the number pulled ... echo %my_random_number% ...
    (microsoft.public.win2000.cmdprompt.admin)
  • Re: process a BIG string
    ... I'm not sure that increasing the execution time will be the solution, ... i need to process every character in a file, so i open the file read ... in buffers of about 8192bytes and process each buffer, ... the problem is that with large filesi get a script error(Fatal ...
    (comp.lang.php)
  • Re: How can I kill a stuck cmd.exe remotely?
    ... sample script code... ... Microsoft MVP - Windows Server Management Infrastructure ... > the cmd would stuck for some reasons I did not know. ... > something in order to run the WMI thing? ...
    (microsoft.public.windowsxp.wmi)
  • Re: CD to acc
    ... I m learning python, so thought i should write small py script to ... os.system (cmd) ... Run this script, while you are in the mounted CD ROM dir... ... To UNSUBSCRIBE, email to debian-user-REQUEST@xxxxxxxxxxxxxxxx with a subject of "unsubscribe". ...
    (Debian-User)
  • Re: Scripts in Vista
    ... that can be tricky using cmd /c etc. ... and put that sort of line in the bat file. ... Monitor your enterprise Web Servers. ... I have tried to no avail to convert this to a script. ...
    (microsoft.public.windows.server.scripting)