随机数字vb.net 随机数抽取
vb.net 随机出数字,但要求包含特定数字如何做?
下面是你需要的,经过三次随机,可以看一下,直接调用函数返回一个字符就是你要的,看不懂再追问哈
为柳河等地区用户提供了全套网页设计制作服务,及柳河网站建设行业解决方案。主营业务为成都做网站、网站建设、柳河网站设计,以传统方式定制建设网站,并提供域名空间备案等一条龙服务,秉承以专业、用心的态度为用户提供真诚的服务。我们深信只要达到每一位用户的要求,就会得到认可,从而选择与我们长期合作。这样,我们也可以走得更远!
Structure jiqi
Dim num As Integer
Dim num2 As Integer
End Structure
Public Function chansheng() As String
Dim str As String = ""
Dim n As Integer = 0
Dim p68 As Integer
Randomize()
p68 = Int(Rnd() * 2) + 1
Dim a(10), b(8) As Integer
For i = 1 To 6
b(i) = i - 1
Next
b(7) = 7
b(8) = 9
For i = 1 To 6
Randomize()
a(i) = b(Int(Rnd() * 8) + 1)
Next
If p68 = 1 Then
For i = 7 To 10
a(i) = 6
Next
ElseIf p68 = 2 Then
For i = 7 To 10
a(i) = 8
Next
End If
Dim c(10) As Integer
Dim temp As jiqi
Dim pi(10) As jiqi
For i = 1 To 10
pi(i).num = a(i)
pi(i).num2 = Int(Rnd() * 1000) + 10
Next
For i = 1 To 10
For j = 1 To 10 - i
If pi(j).num2 pi(j + 1).num2 Then
temp = pi(j + 1)
pi(j + 1) = pi(j)
pi(j) = temp
End If
Next j
Next i
For i = 1 To 10
str = str pi(i).num
Next
Return str
End Function
VB.NET中怎么实现每单击一次按钮,文本框就多出现一个1-13的随机数字?
Dim n As Integer, b As Integer, a(13) As Integer
Private Sub Command1_Click()
If b 5 Then
b = b + 1
x = Int(n * Rnd()) + 1
Text1.Text = Text1.Text a(x) " "
a(x) = a(n)
n = n - 1
Else
Call Form_Load
End If
End Sub
Private Sub Form_Load()
Randomize
n = 13: b = 0
For i = 1 To 13
a(i) = i
Next i
Text1.Text = ""
End Sub
vb.net输出随机数字
Label1.Text =a(i,j) " "
相当于
Label1.Text = Label1.Text a(i,j) " "
1。不能,语法问题。
2。“ ”中包含的是空格,这句话相当于将数组a中的所有数据罗列出来,空格是分隔符,没有它数据就连在一起了,你没法区分了!
文章标题:随机数字vb.net 随机数抽取
分享地址:http://ybzwz.com/article/dooddhs.html