If true randomness isn't necessary: Use first_value() for simplicity which can retrieve the first value in each group:
first_value()
SELECT a, first_value(b) OVER (PARTITION BY a ORDER BY b) AS arbitrary_b FROM foo GROUP BY a;