VB 源码 产生任意数之间随机数,支持负数

来源:互联网 发布:淘宝如何判定做工瑕疵 编辑:程序博客网 时间:2024/05/18 02:37
 '┏〓〓〓〓〓〓〓〓〓 GetRndBeTween3,start 〓〓〓〓〓〓〓〓〓┓
'[简介]:
'产生任意数之间随机数(支持负数)
Function GetRndBeTween3(Number1 As Long, Number2 As Long) As Double
'VB源码,帮你写函数,帮你写代码,帮你写模块,帮你设计软件
'--需要什么函数或功能,可以联系我。
'版权所有,请保留作者信息.QQ:1085992075
'如需商业用途请联系作者
Dim V1 As Long, V2 As Long, V3 As Long
Randomize Timer + Rnd * 10 '重设随机数因子
V1 = Number1
V2 = Number2
If V1 < 0 Then
V3 = -V1
V1 = 0
V2 = V2 + V3
End If
GetRndBeTween3 = V1 + CInt(((V2 - V1) * Rnd)) - V3
End Function
'┗〓〓〓〓〓〓〓〓〓 GetRndBeTween3,end 〓〓〓〓〓〓〓〓〓┛