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.Dismiss alert
Each algorithm provided here currently accepts a single seed arg, assumed to be a number. So at minimum this is 53 bits of state (or 32 bit signed ints if we are treating numbers using JS bitshifting semantics).
Some of the fast 32 bit RNGs use 128 bits of state which in the current scheme could be seeded directly using 4 different state args (for our current purposes, we can think of it as a 4 tuple or vector int32[4]). For the algorithms that need it, this state is mixed internally in the generator function but it could also be seeded directly.
This then raises another question of how to serialize and unserialize the state tuple directly so that generators can be reconstructed with a state that starts anywhere along their sequence, rather than always assuming the ‘seed’ is an initial state.
Similar to #13, this is another situation where an object-oriented API is easier to design.
Functions can have properties in JS so it is possible to do something like this:
import{seeds}from"rung"importgenfrom"rung/algorithms/gen"const[state1,state2,state3,state4]=seeds()constrng=gen(start1,start2,start3,start4)// use rng for a bunch of tasks// ...// dump the internal stateconst[state1,state2,state3,state4]=gen.state()// alternatively, get it from the instanceconst[state1,state2,state3,state4]=rng.state()
This is a workable API. Unclear if it is a good API.
The text was updated successfully, but these errors were encountered:
Each algorithm provided here currently accepts a single seed arg, assumed to be a number. So at minimum this is 53 bits of state (or 32 bit signed ints if we are treating numbers using JS bitshifting semantics).
Some of the fast 32 bit RNGs use 128 bits of state which in the current scheme could be seeded directly using 4 different state args (for our current purposes, we can think of it as a 4 tuple or vector
int32[4]
). For the algorithms that need it, this state is mixed internally in the generator function but it could also be seeded directly.This then raises another question of how to serialize and unserialize the state tuple directly so that generators can be reconstructed with a state that starts anywhere along their sequence, rather than always assuming the ‘seed’ is an initial state.
Similar to #13, this is another situation where an object-oriented API is easier to design.
Functions can have properties in JS so it is possible to do something like this:
This is a workable API. Unclear if it is a good API.
The text was updated successfully, but these errors were encountered: