Page MenuHomeFeedback Tracker

selectRandomWeightedIndex version of selectRandomWeighted that only takes weights
New, NormalPublic

Description

I'd like to request a variation of selectRandomWeighted command that only takes weights and returns index of selected weight. Sadly unary version of selectRandomWeighted is already used and uses single dimension array, so it has to be a new scripting command name.

In my scripting I almost always end up array of indexes and array of weights to the command, because indexes usually point to several data structures and building an array that contains them is not very convenient. I always wished there way a way to just feed the weights and get an index out of them without having to build array of indexes that's not used for anything but feeding into the command.

Suggested syntax:

NUMBER = selectRandomWeightedIndex ARRAY

Example:

selectRandomWeightedIndex [1,1,100]

would most likely return 2

Details

Severity
Feature
Resolution
Open
Reproducibility
N/A
Operating System
Windows 10 x64
Category
Scripting

Event Timeline

SaMatra created this task.Sep 13 2023, 4:19 PM