vb編寫用於求隨機數的程式,vb編寫一個用於求隨機數的程式

2022-03-09 10:51:45 字數 1901 閱讀 5146

1樓:

private sub form_mousedown(button as integer, shift as integer, x as single, y as single)

dim i as integer, f as doublerandomize

if button = vbkeylbutton thend = 50 - rnd(time) * 100msgbox d

else

if button = vbkeyrbutton thenf = format(rnd(time) * 100, "0.00")

msgbox f

end if

end if

end sub

2樓:吹花

private sub command1_click() 'integer

randomize

label1.caption = int(rnd * (101) - 50)

end sub

private sub command2_click() 'single

randomize

label1.caption = format(rnd * (99.991), "0.00")

end sub

用vb編寫一個程式,實現隨機數

3樓:匿名使用者

private sub command1_click()randomize

dim n as integer

n = int(rnd * (150 - 50 + 1)) + 50clsprint n

print hex(n) '十六

print oct(n) '八

end sub

如何用python編寫一個產生1~100的隨機數程式?

4樓:匿名使用者

需要用到random模組

import random

n = random.randint(1,10)會生成一個1到10的隨機整數。

插入列表即可

(急)求一個用vb編寫的能生成隨機數的小軟體

5樓:楓葉剪影

這個效果如何???

樓上的朋友的**會出現重複的數字,我這個不會重複出現同一個數的.

要的話回覆一下.

6樓:匿名使用者

private sub command1_click()dim i as integer, mystr as stringrandomize (timer)

for i = 1 to 55

mystr = mystr & int(55 * rnd()) + 1 & " "

next

msgbox mystr

end sub

用vb做個隨機數程式 20

7樓:匿名使用者

隨機不重複抽取,抽完停止

一個按鈕,輸入**如下:

private sub command1_click()static num(1 to 9), c as integerif c = 9 then exit subc = c + 1

dim s, i

randomize

begin:

s = int(rnd() * (9 - 1 + 1)) + 1if num(s) <> 1 then

i = s

num(s) = 1

else

goto begin:

end if

print i

end sub

vb中如何生成不同的隨機數,VB如何生成隨機數

為了生成某個範圍內的隨機整數,可使用以下公式 int upperbound lowerbound 1 rnd lowerbound 這裡,upperbound 是隨機數範圍的上限,而 lowerbound 則是隨機數範圍的下限。注意若想得到重複的隨機數序列,在使用具有數值引數的randomize 之...

用VB編寫程式,計算求123456200的值

dim n as long,m as longdim i as long n val text1.text m 0for i 1 to n m m 1 i i next i text2.text m end sub 用vb程式設計計算1 2 3 4 5 6 n的值,n由文字框輸入 樓上的程式,個人認...

求大神用vb程式編寫給定整數N,求該整數的原碼,反碼,補碼的程式

private sub command1 click dim a 16 as integer,x as integerx cint text1.text if x 0 then a 16 0 else a 16 1 x abs x for i 1 to 15 a i x mod 2 x x 2 ne...