-
-
Save jrrojasg/053963d84df551752db5c7841bdff49b to your computer and use it in GitHub Desktop.
Revisions
-
Boris Gorbylev revised this gist
Sep 20, 2013 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,7 +2,7 @@ CREATE OR REPLACE FUNCTION random_int_array(dim integer, min integer, max intege begin return (select array_agg(round(random() * (max - min)) + min) from generate_series (0, dim)); end $BODY$ LANGUAGE plpgsql; -- usage example select random_int_array(15, 6, 40); -
Boris Gorbylev renamed this gist
Sep 20, 2013 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
Boris Gorbylev created this gist
Sep 20, 2013 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,14 @@ CREATE OR REPLACE FUNCTION random_int_array(dim integer, min integer, max integer) RETURNS integer[] AS $BODY$ begin return (select array_agg(round(random() * (max - min)) + min) from generate_series (0, dim)); end $BODY$ LANGUAGE plpgsql VOLATILE; -- usage example select random_int_array(15, 6, 40); -- return example -- | random_int_array -- | integer[] -- ----------------------------------------------------- -- 1 | {26,20,13,37,21,25,38,39,36,21,31,6,32,16,22,10}