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,155 of 68,980   
   Herbert Kleebauer to Tom Del Rosso   
   Re: %random% is not random?   
   27 Nov 23 09:42:08   
   
   From: klee@unibwm.de   
      
   On 27.11.2023 08:11, Tom Del Rosso wrote:   
   > Herbert Kleebauer wrote:   
   >>   
   >> 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.   
      
      
   > LINE: rem  get a pseudo random number in case random.org is offline   
   > LINE: if not defined target set target=invalid   
   > LINE: for /f "delims=0123456789 " %%a in ("%target%.") do (   
   > LINE:  if not "%%a"=="." (   
   > LINE:   echo random.org is offline. using pseudo random   
   > LINE:   set /a target = %random% * total / 32768 + 1   
      
   Then you have the same problem: the first %random% isn't   
   random. So better insert a "dummy=%random% at the start of   
   the batch.   
      
   --- 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