Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!
Credits 1,338 Posts 356 Joined 2005-07-15 12:09 20-year member UID 40733 Gender Male
Status Offline
I've always been using for to handle it. The value of %random% never refreshes and is always the same value. I really couldn't help it, so I thought of jumping out of for to refresh the value of %random%. It's a thankless task. I didn't expect it could be done so easily, and I've learned a little more.
Credits 24 Posts 9 Joined 2007-02-09 23:52 19-year member UID 79086 Gender Male
Status Offline
@echo off
setlocal enabledelayedexpansion
set/p jj=Please enter the number of digits of the random number you want to generate:
:start
set x=!x!%random:~-1%
set /a i+=1
if !i! neq !jj! goto start