OK, I got a minute. What we wanna do is pick a random row, but weight it so that some show up more often than others. Here's my very simple solution:
create table rnd(id int, message text, rank float);
insert into rnd values(DEFAULT,'This is an important message',1);
insert into rnd values(DEFAULT,'This is a regular message',0.5);
insert into rnd values(DEFAULT,'This is a very unimportant message',0.1);
Note that you always need one that will meet the threshold, thus the one with a 1.0 value up there. Then, we select a list:
select * from rnd where rank>=random();
This will always return at least one row, the one with the 1.0 value, since the random function returns a value between 0 and 1. If you want to use integers, you could always do something like random()*10 or some other number.
Anyway, the messages with a value of 0.5 will show up half the time in that list, and the messages with a value of 0.1 will show up 10% of the time. But, we need to randomize the order AND select the first one to pop up to the top:
select * from rnd where rank>=random() order by random() ;
id | message | rank
----+------------------------------+------
2 | This is a regular message | 0.5
1 | This is an important message | 1
To make it fair we have to take the lowest value(s) whenever they show up first, otherwise the weighting will actually be a double penalty, since it would first reduce the chance of being selected to the weighting, but then the random ordering would make it equally likely to be removed again.
select * from rnd where rank>=random() order by rank,random() limit 1;
The last random() in the order by makes sure we get a different row of equal weighting when we have lots of rows.