1 つの (seed, counter) の draw を連番で引く列。鍵の計算と PCG64 生成器の作成を 1 回で済ませ、
next_uniform の n 回目は counter_uniform(seed, counter, first_draw + n - 1) と同じ値を返す。
生成器は C++ 側で確保するので、open したら close する。
(seed, counter) の PCG64 を開き、first_draw 回進めた位置に置く。
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(counter_stream_type), | intent(inout) | :: | self | |||
| integer(kind=i32), | intent(in) | :: | seed | |||
| integer(kind=i64), | intent(in) | :: | counter(:) | |||
| integer(kind=i64), | intent(in) | :: | first_draw |
次の draw を (0, 1) で返す。
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(counter_stream_type), | intent(inout) | :: | self |
生成器を解放する(開いていなければ何もしない)。
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(counter_stream_type), | intent(inout) | :: | self |
type :: counter_stream_type private type(c_ptr) :: handle = c_null_ptr contains procedure :: open => open_counter_stream procedure :: next_uniform => counter_stream_next_uniform procedure :: close => close_counter_stream end type counter_stream_type