- What permissions do you give others to modify and/or maintain your submission?
- Modify: YES - Maintain: YES - I give permission for my entire submission to be modified by others or used in their own work. I give permission for my entire submission to be maintained by others as well.
- I made sure my file(s) follow the Submissions Guidelines
- I named my file(s) correctly (see Filename Conventions)
FlowerRNG is a revamped version of my old SeedRng project for v2.1 (hence the name) which has more robust random number generation and is also simpler to use in a correct way. It lets you create multiple random number generator states which need to be seeded, can be network synchronized, et cetera. It provides most of the features of the standard SRB2 random number generator functions (all except RandomChance) and a few additional ones (random 32-bit integers, arrays of those, array shuffling, approximately normally distributed numbers).
L_FlowerRNG_v2.0.wad contains extensive documentation and L_FlowerRNG_tests_v2.0.wad contains some usage examples, but the general way it works is pretty simple. Call
FRNG.Sim_Create(more on that distinction later) and you get a state token that represents that stream of random numbers. Call the other functions (e. g.
FRNG.*_GetFixed) to get random numbers. When you're done with a particular stream, call
FRNG.*_Destroyto delete it.
Note that there are both
Hudfunctions can only be called in HUD or ticcmd hooks and
Simfunctions can only be called outside them. If you pass a state token that was created with
Hudfunction or vice-versa, you will get an error. This is to make it harder to accidentally write code that will desync. Also, Sim states are automatically network-synchronized, while Hud states are not and cannot be network-synchronized.
As stated above, L_FlowerRNG_v2.0.wad contains FlowerRNG itself with full comments and credits; documentation is available there in LDoc format for user-visible functions. L_FlowerRNG_v2.0_commentless.lua is the same library but with blank lines and comments removed, so it's about 10KB smaller before compression. L_FlowerRNG_tests_v2.0.wad adds a console command that tests all of the basic functions of the library and should not be included in mods that use it.
While mainly designed for SRB2 v2.2, it works equally well on SRB2Kart v1.3 and use of it there is supported.
- None currently.
- To prevent name conflicts with another similar library called XRNG, the name has been changed to FlowerRNG and the library is now in the table
FRNG. The library is otherwise compatible.
FRNG.*_GetInt32Array: Returns a specified number of 32 bit integers in an array.
FRNG.GetVersion: Returns a table containing the major, minor, and patch version number (currently 2.0.0).
- Bug and documentation fixes.