Reply
Thu 17 Mar, 2005 02:40 pm
I'm looking for a simple algorithm for selecting items with fixed priority. I.e. if I have a set of items {A,B,C,D,E}, with priorities (1,2,3,4,5} respectively, and these priorities have the weights {100,50,20, 10,2) respectively, then using the sought algorithm for selecting the next item, within any given period of time A will show up twice as much as B, 5 times more times than C, 10 times more than D and 50 times more than E. Any suggestions?
Thanks,
Arie
I'm not great with arrays but wouldn't you create 100 A's (A:1, A:2 etc) and 50 B's, 20 C's, 10 D's and 2 E's then use a random selector on the total set?