home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   alt.msdos.batch.nt      Fun with Windows NT batch files      68,980 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 68,100 of 68,980   
   Herbert Kleebauer to R.Wieser   
   Re: %random% is not random?   
   21 Oct 23 22:10:28   
   
   From: klee@unibwm.de   
      
   On 21.10.2023 20:32, R.Wieser wrote:   
   > Herbert,   
   >   
   >> The first use of %random% always gives nearly the   
   >> same value. Is this a Microsoft feature or a bug?   
   >   
   > "CMD.EXE initializes the random number generator upon startup using a seed   
   > that is derived from the current time with 1 second resolution"   
   >   
   > https://stackoverflow.com/questions/19694021/random-generator-in-the-batch   
      
   That would only mean, that all CMD startet in the same second   
   will have the same random number sequence. But a cmd startet   
   a few seconds later should start with a completely different   
   value. So as a work around, always discard the first %random%   
   value.   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca