6 releases (3 breaking)

0.4.0 Feb 8, 2025
0.3.0 Apr 6, 2021
0.2.2 Jul 3, 2019
0.1.0 Jul 3, 2019

#1004 in Algorithms

Download history 1/week @ 2024-10-29 7/week @ 2024-11-05 10/week @ 2024-12-10 3/week @ 2024-12-17 138/week @ 2025-02-04 17/week @ 2025-02-11

155 downloads per month
Used in geo-visibility

ISC license

9KB
134 lines

geo-rand

This crate contains algorithms to generate random geometric shapes such as polygons.

crate.io docs.rs

This code is a Rust port of this JS code.

Example

The following example shows how to compute a random set of polygons. The rand method is provided by the GeoRand trait which is implemented for some geo-types.

use rand_core::SeedableRng;
use geo_rand::{GeoRand, GeoRandParameters};
let mut rng = rand_pcg::Pcg64::seed_from_u64(0);
let polygons = geo::MultiPolygon::rand(&mut rng, &GeoRandParameters::default());

GeoRandParameters contains fields to customize output.

Dependencies

~9MB
~151K SLoC