📄 form2.frm
字号:
VERSION 5.00
Begin VB.Form Form2
AutoRedraw = -1 'True
Caption = "均匀分布"
ClientHeight = 4485
ClientLeft = 60
ClientTop = 450
ClientWidth = 8220
LinkTopic = "Form2"
ScaleHeight = 4485
ScaleWidth = 8220
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command2
Caption = "返回"
Height = 495
Left = 5640
TabIndex = 2
Top = 3600
Width = 1215
End
Begin VB.CommandButton Command1
Caption = "产生250个(0,1)均匀分布的随机数"
Height = 495
Left = 480
TabIndex = 1
Top = 3600
Width = 3495
End
Begin VB.PictureBox Picture1
AutoRedraw = -1 'True
Height = 3015
Left = 240
ScaleHeight = 2955
ScaleWidth = 7515
TabIndex = 0
Top = 240
Width = 7575
End
End
Attribute VB_Name = "Form2"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim x(1 To 250), y(0 To 250) As Double
Dim n, m, a, c As Integer
Private Sub Command1_Click()
Picture1.Cls
Picture1.Scale (0, 1.5)-(300, -1.5)
Picture1.CurrentX = 0: Picture1.CurrentY = 0: Picture1.Print 0
Picture1.CurrentX = 0: Picture1.CurrentY = 1: Picture1.Print 1
Picture1.CurrentX = 0: Picture1.CurrentY = -1: Picture1.Print -1
y(0) = Int(Rnd(1000) * 10)
a = 5
c = 7
m = 256
For n = 0 To 249
y(n + 1) = (a * y(n) + c) Mod m
x(n + 1) = y(n + 1) / m
Picture1.PSet (n, x(n + 1))
Next n
Picture1.Line (0, 0)-(300, 0), RGB(255, 0, 0)
Picture1.Line (0, 1)-(300, 1), RGB(255, 0, 0)
End Sub
Private Sub Command2_Click()
Form2.Visible = False
Form1.Visible = True
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -