| Class | Basis |
| In: |
basis.f90
|
基本的な計算関数を実行するモジュール
| Subroutine : | |||
| L : | integer, intent(in)
| ||
| output : | integer, intent(inout)
|
任意の桁数で擬似乱数を生成するサブルーチン 混合合同法という乱数生成アルゴリズムを用いて擬似乱数を生成 $x_{n+1}=a\times x_{n}+b (mod \; L)$
subroutine rand_make(L,output)
! 任意の桁数で擬似乱数を生成するサブルーチン
! 混合合同法という乱数生成アルゴリズムを用いて擬似乱数を生成
! $x_{n+1}=a\times x_{n}+b (mod \; L)$
implicit none
integer, intent(in) :: L ! 出力する最大桁数 + 1 の数値
integer, intent(inout) :: output ! 出力される乱数
integer :: a, b, x0, i, input
input=time()
input=mod(input,L)
write(*,*) input
a=11
b=12
x0=input
do i=1,10
x0=a*x0+b
x0=mod(x0,L)
end do
output=x0
end subroutine