pf_random_normal_at Interface

public interface pf_random_normal_at

One standard normal draw: value draw (default 1) of stream i under seed.

i is integer(int32) or integer(int64); seed and draw are integer(int64). Mean 0, variance 1, and the whole real line is reachable up to what the tail algorithm can produce.

Ziggurat over 256 equal-area layers (parquet_ziggurat), which accepts 98.5 % of draws after one 64-bit read and falls back to a wedge test or a tail walk otherwise. Bit-identical for a given libm: the wedge test needs exp and the tail needs log. pf_random_normal_portable_at is the same distribution through a frozen logarithm, identical on every platform.

This does NOT equal %normal at the same coordinate, and that is deliberate. A rejection algorithm consumes a number of words that depends on the values it drew, so no caller can say where value k of a stream walk begins without having drawn the preceding k-1 -- which would make a chunked or threaded fill impossible. The coordinate-addressed forms sidestep that by giving each (i, draw) its own derived sub-stream, so this value is a pure function of its coordinates and a bulk fill splits anywhere. The stream walk cannot do that, because being a walk is its purpose. See pf_normal_algorithm, and pf_random_exp_at for the one distribution where the two DO agree.

Independent of pf_random_normal_portable_at at the same coordinate, by construction: the two derive their sub-streams through different labels, so they are two normals rather than two functions of one uniform. Same for either one against its own stream walk.


Module Procedures

private pure elemental function pf_random_normal_at_i32(seed, i, draw) result(r)

pf_random_normal_at for an integer(int32) stream index.

Arguments

Type IntentOptional Attributes Name
integer(kind=int64), intent(in) :: seed

the stream family's seed

integer(kind=int32), intent(in) :: i

stream index; sign-extends, so any value is valid

integer(kind=int64), intent(in), optional :: draw

1-based value index; absent means 1

Return Value real(kind=real64)

a standard normal draw

private pure elemental function pf_random_normal_at_i64(seed, i, draw) result(r)

pf_random_normal_at for an integer(int64) stream index.

Arguments

Type IntentOptional Attributes Name
integer(kind=int64), intent(in) :: seed

the stream family's seed

integer(kind=int64), intent(in) :: i

stream index; every value is valid

integer(kind=int64), intent(in), optional :: draw

1-based value index; absent means 1

Return Value real(kind=real64)

a standard normal draw