This should be exactly the output you wanted, it's not a true statistically valid sample, but probably close enough.
When you need to get a better sample using RANDOM you must to nest it in a Derived Table:
SELECT * FROM
(SELECT t.*, RANDOM(1,1000000000) as xxx FROM tab AS t) AS tab
QUALIFY
ROW_NUMBER() OVER (PARTITION BY communication_id ORDER BY xxx) <= 10
...
As your table is small, you can easily do it.
Dieter
This should be exactly the output you wanted, it's not a true statistically valid sample, but probably close enough.
When you need to get a better sample using RANDOM you must to nest it in a Derived Table:
SELECT * FROM
(SELECT t.*, RANDOM(1,1000000000) as xxx FROM tab AS t) AS tab
QUALIFY
ROW_NUMBER() OVER (PARTITION BY communication_id ORDER BY xxx) <= 10
...
As your table is small, you can easily do it.
Dieter