中国DOS联盟论坛

China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
Guest | Log in | Register | Members | Search | China DOS Union
中国DOS联盟论坛
The time now is 2026-09-15 12:31
47,812 topics / 349,917 posts / today 0 new / 48,268 members
DOS批处理 & 脚本技术(批处理室) » How to limit %random%
Printable Version  3,101 / 7
Floor1 online365 Posted 2006-10-27 16:06
初级用户 Posts 75 Credits 182
If I want to set %random% to a random number less than 100, how to write it?

[ Last edited by online365 on 2006-11-7 at 08:35 AM ]
Floor2 zerocq Posted 2006-10-27 16:52
中级用户 Posts 196 Credits 458
%random:~-2%

Generate a two-digit random number
Floor3 ccwan Posted 2006-10-27 20:00
金牌会员 Posts 1,160 Credits 2,725 From 河北廊坊
How to avoid 00 appearing?
Floor4 NaturalJ0 Posted 2006-10-27 20:06
银牌会员 Posts 533 Credits 1,181
Floor5 不得不爱 Posted 2006-10-27 20:13
超级版主 Posts 2,044 Credits 5,310 From 四川南充
set/a a=1%RANDOM:~-2%-100
Floor6 online365 Posted 2006-10-28 15:24
初级用户 Posts 75 Credits 182
Thanks
Floor7 namejm Posted 2007-02-04 11:00
荣誉版主 Posts 1,737 Credits 5,226 From 成都
set /a rnd=%random%%%100
Floor8 echoair Posted 2010-05-30 23:36
新手上路 Posts 33 Credits 8
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023