Generating random numbers is a good way to test out our code or to randomize results.
In BigQuery there is a
RAND function which will generate a number between 0 and 1.
But sometimes it’s helpful to get a random integer within a specified range. This snippet will do that:
SELECT ROUND(<min> + RAND() * (<max> - <min>)) rand_between FROM <TABLE>
<max>is the range between which you want to generate a random number