Skip to content

Instantly share code, notes, and snippets.

@spiderbites
Created November 27, 2018 19:00
Show Gist options
  • Save spiderbites/5d7cf0caca20906c4f3973abfac6aa25 to your computer and use it in GitHub Desktop.
Save spiderbites/5d7cf0caca20906c4f3973abfac6aa25 to your computer and use it in GitHub Desktop.
Redshift function - random_between
create or replace function random_between(INT, INT)
returns INT
volatile
as $$
select floor(random() * ($2 - $1 + 1) + $1) :: int;
$$ language sql;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment