Analytics Toolbox for Snowflake

Analytics Toolbox for Snowflake

random

This module contains functions to generate random geographies.

ST_GENERATEPOINTS

Description

Generates randomly placed points inside a polygon and returns them in an array of geographies.

  • geog: GEOGRAPHY a polygon; the random points generated will be inside this polygon.
  • npoints: INT number of points to generate.

Constraints

npoints must not exceed 100000.

Return type

ARRAY

Example

1
2
3
4
5
SELECT sfcarto.random.ST_GENERATEPOINTS(TO_GEOGRAPHY('POLYGON((0 0, 10 0, 10 10, 0 0))'),100);
-- "{\"coordinates\":[6.781385759749447e+00,9.240795947965740e-01],\"type\":\"Point\"}"
-- "{\"coordinates\":[9.993805698147805e+00,5.083022246239731e+00],\"type\":\"Point\"}"
-- "{\"coordinates\":[3.228015360947772e+00,5.353450085600810e-01],\"type\":\"Point\"}"
-- ...

VERSION

Description

Returns the current version of the random module.

Return type

STRING

Example

1
2
SELECT sfcarto.random.VERSION();
-- 1.0.0