mercredi 23 septembre 2020

Generate a random number between a min and max in BigQuery

I'm trying to use BigQuery to generate a random number between 40,000 and 50,957. But I have no idea how to do this; in Snowflake I'd use something like:

select uniform(40000, 50957, random())

But in BigQuery, the RAND() function only generates a random number between 0 and 1. How would I turn this into something that is between 40,000 and 50,957? I'm sure it is probably a matter of figure out the maths but I failed that in highschool so ¯\(ツ)




Aucun commentaire:

Enregistrer un commentaire