Heya everyone…
This may be very easy, but I simply cannot think at it. Heh..
I have 5 functions. I would like each function to have a “percentage” of being triggered every time the page loads, but only one function will be triggered per page.
For example, I have 5 functions each with the alert (‘function 1’), (‘function 2’), …. (‘function 5’);
Function 1 has a 30% chance of being triggered when the page loads
Function 2 has a 20% chance of being triggered
Function 3 has a 80% chance of being triggered
Function 4 only 10% and
Function 5 has a 50% chance of being triggered when the page loads
And at the end of the day, I want only the first function in that order that managed to get triggered to actually… trigger, the rest of them not to, even if they have the chance too.
Can someone give me some help on this? I don’t even know where to start..