- Mar 22, 2013
- 9,148
- 10,490
Well yes, it will tend to pick the higher one due to the nature of how this method works. I don't have the full explanation but you can look it up.
Actually I think I did see it yesterday while googling...
Found it - https://stackoverflow.com/questions/5777400/how-to-use-random-in-batch-script
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.)
Well I think that's it anyway. I saw this before I even made this thread, when I first went to google to try and find a solution for what I needed. Seeing this is possibly what gave me the idea to test the solutions given here to see how often each program gets opened before I put it to use.
Oh well, all good here. Owe you two