I'm trying to make sense of some open-source code, and I've come across this line:
int r = distribution.Random(random.NextDouble());
distribution is an array of doubles.
I've never seen this Random extension applied to an array, and I can't find references to it online. Does anyone have an idea of how it works, exactly?
(For context, this is a part of the Wave Function Collapse algorithm and that specific bit of the code aims, I believe, at drawing an index in an array depending on the probability assigned to that index.)
Aucun commentaire:
Enregistrer un commentaire