I do not know that this can be done very easily with SQL. Using T-SQL or similar, you can write a loop to duplicate rows, or you can use SQL to generate statements to duplicate rows.
I do not know your probabilistic model, but you can use this approach to achieve the latter. Given these table definitions:
RowSource --------- RowID UserRowProbability ------------------ UserId RowId FrequencyMultiplier
You can write a query like this (specific to SQL Server):
SELECT TOP 100 rs.RowId, urp.FrequencyMultiplier FROM RowSource rs LEFT JOIN UserRowProbability urp ON rs.RowId = urp.RowId ORDER BY ISNULL(urp.FrequencyMultiplier, 1) DESC, NEWID()
This will take care of choosing a random set of rows, as well as how much should be repeated. Then, in your application logic, you can duplicate rows and shuffle the results.
Jacob source share