17568, "vasslitvinov", "should RandomStream.getNth() and skipToNth() accept any integral type?", "2021-04-14T03:22:04Z"
Right now the classes PCGRandomStream
and NPBRandomStream
declare these methods with generic integral
formals:
proc skipToNth(n: integral): void throws {...}
proc getNth(n: integral): eltType throws {...}
However, the current implementation adds the n
formal onto PCGRandomStreamPrivate_count
or NPBRandomStreamPrivate_count, which are declared with the type
int`. So:
- It does not compile if my actual argument is a
uint
. - It does not offer me any savings benefits if my actual argument is a smaller int or uint.
If it is important for us to support the uint
use case, we should parameterize these classes by the count type.
Otherwise I suggest to streamline the interface by switching the n
formals to the type int
.