If you need a random number no larger than 32767, you can use the reserved environment variable %random% to generate one. Try this in a command window:
echo %random%
This should return a value between 0 and 32767. If you need larger, create another random number and multiply them. If you need less, figure out a formula. It is actually quite easy…