Mollymews Posted January 8, 2022 Share Posted January 8, 2022 (edited) 6 hours ago, testgenord1 said: endless loop mathproblem() { if (somerandomthing == someotherrandomthing) { mathproblem(); } } to address this then we need to change to a 'conditional random' algorithm that breaks ties. Is a number of ways to do this. The most straightforward method to break ties is additive. Example: [hmm! wrong example deleted] this one quotient = (integer)llFrand(range); divisor = (integer)llFrand(range - 1) + 1; dividend = quotient / divisor; // calculate 'random' distractors that conditionally break ties // dividend == (0) -> (0) // distractor1 == (0) -> (1) // distractor2 == (0) -> (1) ... (1) -> (2) distractor1 = llFrand(range); distractor2 = llFrand(range); if (distractor1 == dividend) { // add some distractor1 += 1.0; } while ((distractor2 == dividend) || (distractor2 == distractor1)) { // add some. while loop will run max. 2 times distractor2 += 1.0; } Edited January 8, 2022 by Mollymews simplify 1 Link to comment Share on other sites More sharing options...
animats Posted January 8, 2022 Share Posted January 8, 2022 5 hours ago, Lucia Nightfire said: 🤔 You're right. My bad. Link to comment Share on other sites More sharing options...
Recommended Posts
Please take a moment to consider if this thread is worth bumping.
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now