Script misc_helper

misc.

common tools for 4dguns

Functions

Guns4d.math.weighted_randoms (tbl) picks a random index, with odds based on it's value.


Functions

Guns4d.math.weighted_randoms (tbl)
picks a random index, with odds based on it's value. Returns the index of the selected.

Parameters:

  • tbl

    a table containing weights, example

      {
          ["sound"] = 999, --999 in 1000 chance this plays
          ["rare_sound"] = 1 --1 in 1000 chance this plays
      }
    
generated by LDoc 1.5.0 Last updated 2024-01-16 17:04:01