bondigor69 2 Posted January 5, 2014 Report Share Posted January 5, 2014 I want my bot comment 30% of the time, hw can I do that ? Quote Link to post Share on other sites
giganut 109 Posted January 5, 2014 Report Share Posted January 5, 2014 Could you be a little more clear about what you mean please, thanks. Quote Link to post Share on other sites
HelloInsomnia 1103 Posted January 5, 2014 Report Share Posted January 5, 2014 Here is a really simple way. set(#random_number, $rand(1, 100), "Global") if($comparison(#random_number, "<=", 30)) { then { comment("post comment") } else { } } 1 Quote Link to post Share on other sites
bondigor69 2 Posted January 5, 2014 Author Report Share Posted January 5, 2014 Here is a really simple way. set(#random_number, $rand(1, 100), "Global") if($comparison(#random_number, "<=", 30)) { then { comment("post comment") } else { } } It doesn't make 30% of a time... what if for 20 times the number is between 1 and 30. I'm saying that because I used that method before Quote Link to post Share on other sites
bondigor69 2 Posted January 5, 2014 Author Report Share Posted January 5, 2014 Could you be a little more clear about what you mean please, thanks.Something like PHP modulus perhaps Quote Link to post Share on other sites
HelloInsomnia 1103 Posted January 5, 2014 Report Share Posted January 5, 2014 It doesn't make 30% of a time... what if for 20 times the number is between 1 and 30. I'm saying that because I used that method before If you want it to be exactly 30% then you need to keep track of everytime you posted and didn't post, then compare the numbers and get the percentage and once the posted drops below 30% then it posts again. But keep in mind this also forms a pattern. For example first post the posted is at 0% so it posts always on the first post and then always skips the next 3 then the posted is at 25% so it always posts that time and so on. Quote Link to post Share on other sites
the_way 52 Posted January 5, 2014 Report Share Posted January 5, 2014 a list with 9 choices, and 3 of those choices being comment, while the other 6 being no comment, then pick random item will do the trick. You could work through the order sequentially if you'd prefer to get the exact percentage per 9 tries. 1 Quote Link to post Share on other sites
Kev 69 Posted January 15, 2014 Report Share Posted January 15, 2014 Similar to quite_interesting: Have a list numbered 1-10. Randomly take a number between 1 and 10. Add THAT random number to a list. Now, REMOVE that number from the original list. If that number is 1,2 or 3 then post a comment. So let's say the number 3 is randomly selected. It removes that from the original list and adds it to the new list, then goes to post the comment. Next time the random number runs, let's say it's again 3, it checks to see does it exist in the new list. If it does, go again for a random number (in this case it does). So, you will need to check the new list each time to ensure the number hasn't been used already. Ultimately I wouldn't imagine you'd be caught in a loop checking for too long, but hey, what if the random number was 1,2 or 3 a thousand times? Anyhow, that's one way. I'm sure there are easier ways. Just thought of this one now. Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.