I want a random number in Windows batch. Here's my command:
set /a "random_line=(%random%%%total)+1"
Is this going to give me an even distribution of random numbers?
EDIT:
I'd already looked at How to use random in BATCH script?, and CherryDT's answer made me ask the question about even distribution:
Note that this will not be uniformly distributed! Taking the 0~99 example, the numbers 0~67 will occur slightly more often than the numbers 68~99 because 32767 modulo 100 is 67 and not 0 as it would have to be for a uniform distribution. (This
%random% %%100
is no magic syntax but actually%random % %% 100
with one less space, where the%%
is just an escaped%
which stands for modulo.)
So to clarify, will this give me uneven distribution?