Thursday, 22 August 2013

rand() function in with probability in chossing IP's

rand() function in with probability in chossing IP's

Hi I'm working on a project in c
I have 3 IPs and every IP has a weight, I want to return the IP's
according to its weights using the random function,,,, for example if we
have 3 IP's : X with weight 6,Y with weight 4 and Z with weight 2, I want
to return X in 50% of cases and Y in 33% of cases and Z in 17% of cases,
depending on random function in C.
could any one help me with this please ?

No comments:

Post a Comment