You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.
The current implementation of PCGSource has a number of missing features, mostly related to control over the seeding process. The Seed() method even has a TODO in it:
// Seed uses the provided seed value to initialize the generator to a deterministic state.func (pcg*PCGSource) Seed(seeduint64) {
pcg.low=seedpcg.high=seed// TODO: What is right?
}
Similarly, there's no way to get access to the current seed data.
This would give much greater control over the source.
Bikeshed Color 2
Alternatively, I recently copied the existing implementation in order to remove the internal state from it completely for a somewhat specific use case. I replaced the entire system with single function, func Next(high, low uint64) (n, nhigh, nlow uint64), that gave me full control over the generation.
If such a function was added, the existing implementation could easily be changed to just call any such function instead:
Note that the PRNG state can be marshaled and unmarshaled which already provide these functionalities (though not directly and they require that the user knows the size of the seed fields — this could be noted in the documentation).
The current implementation of
PCGSource
has a number of missing features, mostly related to control over the seeding process. TheSeed()
method even has aTODO
in it:Similarly, there's no way to get access to the current seed data.
Bikeshed Color 1
I propose adding a new function and two methods:
This would give much greater control over the source.
Bikeshed Color 2
Alternatively, I recently copied the existing implementation in order to remove the internal state from it completely for a somewhat specific use case. I replaced the entire system with single function,
func Next(high, low uint64) (n, nhigh, nlow uint64)
, that gave me full control over the generation.If such a function was added, the existing implementation could easily be changed to just call any such function instead:
Summary
I'm bikeshedding a bit, but my only point is that I'd like some greater control over the
PCGSource
implementation's seeding process.The text was updated successfully, but these errors were encountered: