vb.net随机数字 随机函数vb产生数字
vb.net输出随机数字
Label1.Text =a(i,j) " "
目前成都创新互联公司已为上1000家的企业提供了网站建设、域名、网络空间、网站改版维护、企业网站设计、独山网站维护等服务,公司将坚持客户导向、应用为本的策略,正道将秉承"和谐、参与、激情"的文化,与客户和合作伙伴齐心协力一起成长,共同发展。
相当于
Label1.Text = Label1.Text a(i,j) " "
1。不能,语法问题。
2。“ ”中包含的是空格,这句话相当于将数组a中的所有数据罗列出来,空格是分隔符,没有它数据就连在一起了,你没法区分了!
vb。net取随机数
取随机数可以用 Random 类。
给定10个数的话,可以把这10个数放在一个数组里,然后取0~9的范围内的随机数,用它当数组下标取数组成员即可。
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随机数字 随机函数vb产生数字
URL分享:http://ybzwz.com/article/dochjei.html