Thursday, December 19, 2013

How randomly selected in several options. . .

Heroes of you may have any ideas?
Reply:
Choose a chant with a random number, and each option corresponds to a range of
Reply:
Trouble can say elaborate?

cited a floor ultrapro reply:
using random numbers to choose a chant, each option corresponds to a range of

Reply:
Do not understand what is meant by a random number landlord can it
 
int index = random ()% count;

Reply:
Random number, then the better. . .
int value = arc4random ()% x; generates a random number of 1 to x-1. . .

Randomly selected ah randomly selected. . .

reference to the third floor stonexing5 reply:
do not understand what is meant by a random number landlord can it

C / C + + code


int index = random ()% count;

Reply:
A random number (0 ---- 0.999999). Taken out, multiplied by the number of options you want max_index * random ()
Then erase the decimal point, and replaced with int
Reply:
Brother, I'm begging you, do not mention random things, that I know, talking about random issues. . .

references, 5th Floor ocoolo reply:
random number (0 ---- 0.999999). Taken out, multiplied by the number of options you want max_index * random ()
Then erase the decimal point, and replaced with int

Reply:
up together, I mean to say how to achieve the realization of multiple buttons disrupted for example, and then to a random sample, if the random number, the problem is that I will lead a few buttons and this one is no longer a sign corresponding relationship between the
Reply:
Is this mean?
Button disrupted btn.tag = arc4random ();
Then sorted by size tag, and then index = arc4random ()% count, taking the first few btn
Reply:
Ah, man, this idea is actually quite good, but now with btn.tag = arc4random (); disrupted button may be circumstances where the two buttons tag value equal ah



reference to the 8th floor flyeag reply:
is this mean?
Button disrupted btn.tag = arc4random ();
Then sorted by size tag, and then index = arc4random ()% count, taking the first few btn

No comments:

Post a Comment