Hi,
I would like to ask if there is any way where i can randomly select the member by age and sex?
Thanks,
Leahcim
Randomly select in the roster by age and sex
-
- Posts: 1796
- Joined: December 5th, 2011, 11:27 pm
- Location: Washington, DC
Re: Randomly select in the roster by age and sex
See a recent post about this: viewtopic.php?f=1&t=5115
There are a variety of random-related functions in CSPro, including: https://www.csprousers.org/help/CSPro/r ... ction.html
One option is to loop through your roster and fill a list object with the occurrences of each applicable member. Then you can select the random member using:
There are a variety of random-related functions in CSPro, including: https://www.csprousers.org/help/CSPro/r ... ction.html
One option is to loop through your roster and fill a list object with the occurrences of each applicable member. Then you can select the random member using:
list eligible_members;
// ... fill this
if eligible_members.length() > 0 then
numeric selected_member = random(1, eligible_members.length());
// ...
// ... fill this
if eligible_members.length() > 0 then
numeric selected_member = random(1, eligible_members.length());
// ...