I'll explain what I'm doing first as I don't know the mathematical term.
I want to pick topics at random from a forum database but I want it to concentrate on picking the newest posts first. Basically I'll have order by latest posts and want the most recent topics returned more often than topics that are a year or two old.
Now doing something like
$num = (time() & 1) ? mt_rand(1, 10) : mt_rand(1, mt_rand(10, 1000));
this will give make the numbers 1 - 10 appear more than 10 - 1000 but a number like 134 has the same probability as 857 which isn't ideal.
If a forum has 100k topics it's not much use. I want 1 to have a greater change of appearing than 2 which would be greater than 3 which would be greater than 4 ....etc.
It's to be used on a script that adds a reply to the topics so I want it to be natural and add replies randomly to the most recent topics and only occasionally bump old topics sorta like the way a real forum works.
I don't mind if I get one number per run but ideally I'd have say 10 so I could run a loop on say 10 topics at a time.
I hope you understand what I'm trying to accomplish. Anyone have any ideas or suggestions on how best to do this?