API Reference better_weighted_random v0.1.0
Modules
Module to take random elements from enumerable based on their weights.
Search table maps value ranges to some result (ex. score). Example of such table: [{:neg_inf, 0}, {-30, 4}, {-20, 8}, {-10, 10}, {10, 7}, {20, 0}] It will give such results with 'search' function: -50 -> 0 -30 -> 0 -29 -> 4 -15 -> 8 -10 -> 8 0 -> 10 10 -> 7 15 -> 7 30 -> 0