A uniform integer in [lo, hi], exactly unbiased: value draw (default 1) of stream i.
i, lo and hi share one kind -- integer(int32) or integer(int64) -- and the result
follows it; seed and draw are always integer(int64). Swaps internally when lo > hi,
so the function is total. Every width is exact, including the widest: no modulo bias, at any
range, on either side of the fork.
pf_random_int_at for integer(int32) stream index and bounds.
The result is inside [min(lo,hi), max(lo,hi)] by construction, so narrowing the int64
worker's answer back to int32 is exact and cannot overflow.
| Type | Intent | Optional | 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=int32), | intent(in) | :: | lo |
one end of the closed range |
||
| integer(kind=int32), | intent(in) | :: | hi |
the other end; |
||
| integer(kind=int64), | intent(in), | optional | :: | draw |
1-based value index; absent means 1 |
a uniform integer in [min(lo,hi), max(lo,hi)]
pf_random_int_at for integer(int64) stream index and bounds.
| Type | Intent | Optional | 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) | :: | lo |
one end of the closed range |
||
| integer(kind=int64), | intent(in) | :: | hi |
the other end; |
||
| integer(kind=int64), | intent(in), | optional | :: | draw |
1-based value index; absent means 1 |
a uniform integer in [min(lo,hi), max(lo,hi)]