I needed to generate 1000+ random dates over the period of 2 years and the code found here did the job well. However, since I'm visualizing this data, I would prefer if every date in the chosen time period appeared in the dataset at least once, otherwise the line chart keeps jumping too much. How would I go about it? Here the initial code used:
WITH parameters AS (
SELECT 100 ids_count, DATE '2010-01-01' start_date, DATE '2020-12-31' finish_date
)
SELECT id, DATE_FROM_UNIX_DATE(CAST(start + (finish - start) * RAND() AS INT64)) random_date
FROM parameters,
UNNEST(GENERATE_ARRAY(1, ids_count)) id,
UNNEST([STRUCT(UNIX_DATE(start_date) AS start, UNIX_DATE(finish_date) AS finish)])
-- ORDER BY id