複数のseed値を使って擬似乱数列生成用データを初期化します。

Namespace: fvalgcli
Assembly: fvalgcli (in fvalgcli.dll) Version: 3.1.0.0 (3.1.0.11)

Syntax

C#
public static void fnFIE_mtrand_init_by_array(
	uint[] init_key,
	int key_length,
	ref F_RANDDESC r
)
Visual Basic
Public Shared Sub fnFIE_mtrand_init_by_array ( 
	init_key As UInteger(),
	key_length As Integer,
	ByRef r As F_RANDDESC
)

Parameters

init_key
Type: array<System..::..UInt32>[]()[][]
擬似乱数列のseedの数列
key_length
Type: System..::..Int32
seed数列の要素数
r
Type: fvalgcli..::..F_RANDDESC%
擬似乱数列生成用データ

Examples

C# Copy imageCopy
//    $Revision: 1.1 $

using System;
using System.Collections.Generic;
using System.Text;
using fvalgcli;

namespace TC
{
    public partial class FIE
    {
        [FvPluginExecute]
        public void fnFIE_mtrand_init_by_array()
        {
            int key_length = 3;
            uint[] init_key = new uint[key_length];        // 適当な値.
            uint[] init_key2 = new uint[key_length];    // 適当な値.
            uint[] init_key_eq = new uint[key_length];    // 適当な値.
            F_RANDDESC r = new F_RANDDESC();
            F_RANDDESC r2 = new F_RANDDESC();
            F_RANDDESC r_eq = new F_RANDDESC();

            // init_keyに適当な値を代入.
            for (int i = 0; i < key_length; i++)
            {
                init_key[i] = (uint)i;
                init_key2[i] = (uint)i + 2222;
                init_key_eq[i] = (uint)i;
            }

            // 初期化1.
            api.fnFIE_mtrand_init_by_array(init_key, key_length, ref r);
            // 初期化2.
            api.fnFIE_mtrand_init_by_array(init_key2, key_length, ref r2);
            // 初期化3.
            api.fnFIE_mtrand_init_by_array(init_key_eq, key_length, ref r_eq);

            Assert.IsTrue(r.mt[1] == r_eq.mt[1], "エラーが発生しました。");
            Assert.IsFalse(r.mt[1] == r2.mt[1], "エラーが発生しました。");

            //結果を出力する.
            ConsoleOut.WriteFunctionName(":\n");
            Console.Write(" ...");
            ConsoleOut.IsTrue(r.mt[1] == r_eq.mt[1]);
        }
    }
}


Visual Basic Copy imageCopy
'    $Revision: 1.1 $

Imports System.Collections.Generic
Imports System.Text
Imports fvalgcli

Public Partial Class FIE
    <FvPluginExecute> _
    Public Sub fnFIE_mtrand_init_by_array()
        Dim key_length As Integer = 3
        Dim init_key As UInteger() = New UInteger(key_length - 1) {}
        ' 適当な値.
        Dim init_key2 As UInteger() = New UInteger(key_length - 1) {}
        ' 適当な値.
        Dim init_key_eq As UInteger() = New UInteger(key_length - 1) {}
        ' 適当な値.
        Dim r As New F_RANDDESC()
        Dim r2 As New F_RANDDESC()
        Dim r_eq As New F_RANDDESC()

        ' init_keyに適当な値を代入.
        For i As Integer = 0 To key_length - 1
            init_key(i) = CUInt(i)
            init_key2(i) = CUInt(i) + CUInt(2222)
            init_key_eq(i) = CUInt(i)
        Next

        ' 初期化1.
        api.fnFIE_mtrand_init_by_array(init_key, key_length, r)
        ' 初期化2.
        api.fnFIE_mtrand_init_by_array(init_key2, key_length, r2)
        ' 初期化3.
        api.fnFIE_mtrand_init_by_array(init_key_eq, key_length, r_eq)

        Assert.IsTrue(r.mt(1) = r_eq.mt(1), "エラーが発生しました。")
        Assert.IsFalse(r.mt(1) = r2.mt(1), "エラーが発生しました。")

        '結果を出力する.
        ConsoleOut.WriteFunctionName(":" & vbLf)
        Console.Write(" ...")
        ConsoleOut.IsTrue(r.mt(1) = r_eq.mt(1))
    End Sub
End Class

See Also