Re: Seeding Randomization on CMD (WinXP Pro)

From: PsyB (psychopathNO_at_MEATshaw.ca)
Date: 10/06/04


Date: Wed, 06 Oct 2004 14:41:38 -0600


Mark V wrote:
> 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.
>
>
>
Thanks Mark! The results are much better than the cmd random!
(0-65535)
10/06/04 14:36:47.98 40675
10/06/04 14:36:48.21 8629
10/06/04 14:36:48.56 21153
10/06/04 14:36:48.94 49863
10/06/04 14:36:49.30 5391
10/06/04 14:36:49.69 46269
10/06/04 14:36:50.03 43875
10/06/04 14:36:50.37 39443
10/06/04 14:36:50.71 46841
10/06/04 14:36:51.10 24825
10/06/04 14:36:51.48 56105
10/06/04 14:36:51.84 56887
10/06/04 14:36:52.23 29617
10/06/04 14:36:52.63 33519
10/06/04 14:36:53.06 31879
10/06/04 14:36:53.45 42001
10/06/04 14:36:53.83 12659
10/06/04 14:36:54.22 60385
10/06/04 14:36:54.58 42743
10/06/04 14:36:54.97 49665
10/06/04 14:36:55.36 6645
10/06/04 14:36:55.77 62843
10/06/04 14:36:56.15 59877
10/06/04 14:36:56.59 55317

-- 
-=[PsyB]=-
Greater in battle than the man who would conquer a thousand-thousand men 
is he who would conquer just one - *himself*.
                                                --Dhammapada--


Relevant Pages

  • Re: codepage
    ... yes, thnx, this oemcp registry solved the direct problem, now cmd starts ... with desired codepage, but, there is ... still mess with cmd prompt displaying characters. ... In addition to what Mark V has posted. ...
    (microsoft.public.win2000.cmdprompt.admin)
  • Re: Dynamischer Benutzerprofilpfad
    ... Denn SET definiert die Variable nur innerhalb der gerade der aktiven ... CMD ... ... Mark Heitbrink - MVP Windows Server - Group Policy ...
    (microsoft.public.de.german.windows.server.active_directory)
  • Re: HELP! Tools applications imediately quit
    ... Thank you Mark, this is a good workaround and perhaps the only solution I ... > Mark L. Ferguson ... >> In my Windows XP Pro, various tools applications like tasklist.exe, quit ... >> the Cmd window, all is fine. ...
    (microsoft.public.windowsxp.help_and_support)
  • Re: DOS blanks half of the screen
    ... "Mark L. Ferguson" wrote: ... "rostie" wrote: ... When the association calls up CMD, you get the program to run in the proper full-screen CMD window. ...
    (microsoft.public.windowsxp.help_and_support)
  • Re: [PATCH #2] Re: SATA and 2.6.0-test9
    ... The 4th port seems to ... ata_bus_reset: EXIT ... ata_exec_command_mmio: ata1: cmd 0xEC ... ata_device_add: ata4: probe-wait begin ...
    (Linux-Kernel)