This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WITH RECURSIVE results(id, i, picked, roll) AS ( | |
WITH bounds AS (SELECT min(id), max(id) - min(id) AS delta FROM table) | |
( | |
SELECT NULL::integer | |
, 0 | |
, ARRAY[]::integer[] | |
, min + round(delta * random()) | |
FROM bounds | |
) | |
UNION ALL |