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
Currently, Signaletic uses rand() from the standard library to implement our randf() function. This works for the moment because all our target platforms provide an implementation, but it may be slower than is ideal (because on ARM, the hardware may provide faster implementations and on wasm, Emscripten's implementation likely requires a call to JavaScript to get a seed).
We should implement a very simple, fast default random number generator that allows the user to provide their own seeds, and which can support Host-provided seeding strategies.
As noted in a comment in the code above sig_randf(), I think the best option for this is to implement the "quick and dirty" LCR method documented in Numerical Recipes in C.
This should be implemented as new struct that provides randf, seed, and any other necessary base functions as pointers so that alternative implementations can be provided if needed.
Currently, Signaletic uses
rand()
from the standard library to implement ourrandf()
function. This works for the moment because all our target platforms provide an implementation, but it may be slower than is ideal (because on ARM, the hardware may provide faster implementations and on wasm, Emscripten's implementation likely requires a call to JavaScript to get a seed).We should implement a very simple, fast default random number generator that allows the user to provide their own seeds, and which can support Host-provided seeding strategies.
The minimal PCG implementation or TinyMT32 are two mainstream options, while the musicdsp forum provides some very simple and fast-looking options since we don't need cryptographic rigour.
The text was updated successfully, but these errors were encountered: