分享你我的心得.
共乘一片美好网络.

随机数

<%
Function GetRndNum(Upperbound , Lowerbound)

 

Dim mReturn

 

Randomize

 

mReturn = Int((Upperbound – Lowerbound + 1) * Rnd + Lowerbound)

 

GetRndNum = mReturn

 

End Function

 

for i=1 to 5

 

response.write GetRndNum(10000000,99999999)&"<br>"

 

next
%>

 

<SCRIPT LANGUAGE="VBScript">
Dim jnkcD,jnkcNum,aKey

 

Set JnkcD = CreateObject("Scripting.Dictionary")
Randomize
Do Until JnkcD.Count=<%=request("num")%>
jnkcNum = Int((1000000000-9999999999+1) * Rnd +9999999999)
If Not JnkcD.Exists(jnkcNum) Then JnkcD.Add jnkcNum,Null
Loop
For Each aKey In JnkcD.Keys()
i=i+1
document.write "卡号:"&akey&"&nbsp;&nbsp;&nbsp;"&i&"&nbsp;&nbsp;&nbsp;"& "<br>"

 

Next
Set jnkcD = Nothing
</SCRIPT>
##########################################################
<script>
function getNickName(){
var allChar = "abcdefghijklmnopqrstuvwxyz".split("");
var myarray = [];
for(var i = 0;i < 8; i ++ ){
myarray.push(allChar[Math.round(Math.random()*25)]);
}
myarray = myarray.sort(function() {return 0.5 – Math.random()})
return myarray.join("");
}
document.writeln(getNickName())
</script>
 

赞(0)
未经允许不得转载:小叶白龙博客 » 随机数
分享到: 更多 (0)

评论 28

评论前必须登录!