Skip to main content

pick_recipe

Function pick_recipe 

Source
pub fn pick_recipe(selector: i32, weights: &[f32], rng: &mut Random) -> usize
Expand description

The recipe a production cycle uses: the selected one; or, with the selector at −1 (any), one RandFloat over the weights, the first whose running sum passes the draw times their total; 0 for any other selector, or when no weight passes.

Measured: tools/emu/recipe_pick.py (the original on 2,000 cases).

Original: FUN_14011e940.