⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 d6r11.frm

📁 常用的数值算法的VB程序
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "Form1"
   ClientHeight    =   5070
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   5010
   LinkTopic       =   "Form1"
   ScaleHeight     =   5070
   ScaleWidth      =   5010
   StartUpPosition =   3  'Windows Default
   Begin VB.CommandButton Command1 
      Caption         =   "Command1"
      Height          =   375
      Left            =   3480
      TabIndex        =   0
      Top             =   4320
      Width           =   1095
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
    'PROGRAM D6R11
    'Driver for routine IRBIT2
    'Calculate distribution of runs of zeros
    NBIN = 15: NTRIES = 10000
    Dim DELAY(15)
    ISEED = 111
    For I = 1 To NBIN
        DELAY(I) = 0#
    Next I
    IPTS = 0
    For I = 1 To NTRIES
        If IRBIT2(ISEED) = 1 Then
            IPTS = IPTS + 1
            IFLG = 0
            For J = 1 To NBIN
                If (IRBIT2(ISEED) = 1) And (IFLG = 0) Then
                    IFLG = 1
                    DELAY(J) = DELAY(J) + 1#
                End If
            Next J
        End If
    Next I
    Print "Distribution of runs of N zeros"
    Print "    N     Probability   Expected"
    For N = 1 To NBIN
        Print Tab(5); Format$(N - 1, "####0");
        Print Tab(12); Format$(DELAY(N) / IPTS, "#.#####0");
        Print Tab(25); Format$(1# / (2# ^ N), "#.#####0")
    Next N
End Sub
Static Function IRBIT2(ISEED)
    IB1 = 1: IB3 = 4: IB5 = 16: IB14 = 8192: MASK = 21
    If (ISEED And IB14) <> 0 Then
        ISEED = ISEED Xor MASK
        If ISEED > 2 ^ 14 Then ISEED = ISEED - 2 ^ 14
        ISEED = 2 * ISEED Or IB1
        IRBIT2 = 1
    Else
        If ISEED > 2 ^ 14 Then ISEED = ISEED - 2 ^ 14
        ISEED = 2 * ISEED And (Not IB1)
        IRBIT2 = 0
    End If
End Function

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -