-
-
Notifications
You must be signed in to change notification settings - Fork 117
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
weighted random selector/sequence #206
Conversation
Looking great - don't forget to also add some tests for this. |
6c006d1
to
3f78afa
Compare
@lostptr a couple of findings:
|
Yeah I noticed that too but I had no ideia how to deal with that and thought it wasn't such I big deal. However, I can see how that can be annoying and cause a bunch of silly bugs because people would not notice. I found a way to fix that, albeit not very elegant 😆.
Oops! |
…have into feat/weighted-random
4a03eb9
to
4e1534a
Compare
@lostptr Why didn't the test fail? Or was the test broken too? |
There where no tests for the selector thats why. I have added them in the latest commit. |
Description
To better encapsulate the random manipulation logic for composites, I created a
RandomizedComposite
node that should never be used as is; it is only so that logic can be shared forSelectorRandom
andSequenceRandom
(or else, I would have to copy and paste a hundred lines on both scripts)This new class contains the seed settings, option to specify weights for each child and the shuffle logic.
Addressed issues
Screenshots
Weights editor:
Proof of concept
I made a little test to make sure that the weights are actually affecting the random sampling by recording all of the times a node was picked as the first child.
After 36698 times: