Sign-up....

怎样从一组中,随机提取一个

1,2,3

怎么随机提取一个。给变量赋值?

[24 byte] By [msdn] at [2007-8-15 10:04:29]
# 1 Re: 怎样从一组中,随机提取一个

变量=Int((3 * Rnd) + 1)

Richard1979 at 2006-6-9 17:00:14 >
# 2 Re: 怎样从一组中,随机提取一个

或者你要的不是数据就可以这样

a=1,2,3

b=Split(a,",")

Randomize

x=Int((3 * Rnd) + 1)

y=a(x)

Richard1979 at 2006-6-9 17:03:35 >
# 3 Re: 怎样从一组中,随机提取一个

上面写错了。看这里

a="aaa,bbbb,cccc"

b=Split(a,",")

Randomize

x=Int((3 * Rnd) + 1)

y=b(x)

Richard1979 at 2006-6-9 17:04:50 >
# 4 Re: 怎样从一组中,随机提取一个

晕,谢谢楼上的,我也找到一个笨办法。。。。

ip1 = cInt(2*rnd)

If ip1=0 then response.write (61)

If ip1=1 then response.write (218)

If ip1=2 then response.write (211)

nuomande at 2006-6-9 17:13:07 >
# 5 Re: 怎样从一组中,随机提取一个

用Rnd函数

taolixiang at 2006-6-9 17:36:31 >

Web

All Classified