lundi 6 septembre 2021

simple script to set probability of a chosen item within a folder

If I were to have three folders, each with a different amount of items in them, how could I write a simple script that will pick a certain folder based on a probability for each item. For example Folder A has 30 items, Folder B has 5 items and Folder C has 2 items. I want there to be a 70% chance of any of the items in Folder A to be chosen, a 20% for any item in Folder B and a 10% chance for any item in Folder C. I want the script to pick the folder based on these probabilities so that is you ran it 100 times, the items would show up with that given amount of percentage. Is this possible to do. I'm more so just curious about the logic rather than the code.




Aucun commentaire:

Enregistrer un commentaire