This file contains 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 characters
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; | |
-- usage example | |
select random_int_array(15, 6, 40); | |
-- return example |