I'm looking to anonymize some marketing data for visualization purposes. To do this, I've created several arrays that replace existing campaign names with anonymized values, such as Campaign 1, Campaign 2, Campaign 3, etc...
I got this working in a PostgreSQL database using the following query:
(ARRAY['Campaign 1'::text, 'Campaign 2'::text, 'Campaign 3'::text, 'Campaign 4'::text, 'Campaign 5'::text])[(floor(random() * 5::double precision) + 1::double precision)] AS campaign_name
This does what I need in that it randomly assigns a Campaign the numbers 1-5 for each row of data.
I tried to mimic this in BigQuery but am having trouble. I switched random to rand but that did not work. Anyone done something like this before?