Hey all! I was wondering how do you implement random events in a website like neopets? I guess it's a code that uses probabilities but what does it look like?
There are many ways to, but a simple way to do it is to use PHP. There is a random function called mt_rand(). http://php.net/manual/en/function.mt-rand.php If you don't want a person to have too many random events, you could have an entry in an SQL data table for each user for the last time that they got an event like that. If the last time is long enough in the past, then if mt_rand(1, 100000000) = 5820, then generate an event.