Skip to content

Instantly share code, notes, and snippets.

@le0pard
Created April 8, 2011 21:22
Show Gist options
  • Save le0pard/910763 to your computer and use it in GitHub Desktop.
Save le0pard/910763 to your computer and use it in GitHub Desktop.
Random Range
CREATE OR REPLACE FUNCTION random(numeric, numeric)
RETURNS numeric AS
$$
SELECT ($1 + ($2 - $1) * random())::numeric;
$$ LANGUAGE 'sql' VOLATILE;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment