Returns a random positioned Rect on a 0..1 scale.
import { Rects } from "https://unpkg.com/ixfx/dist/geometry.js";const r = Rects.random(); // eg {x: 0.2549012, y:0.859301, width: 0.5212, height: 0.1423 } Copy
import { Rects } from "https://unpkg.com/ixfx/dist/geometry.js";const r = Rects.random(); // eg {x: 0.2549012, y:0.859301, width: 0.5212, height: 0.1423 }
A custom source of randomness can be provided:
import { Rects } from "https://unpkg.com/ixfx/dist/geometry.js";import { weightedSource } from "https://unpkg.com/ixfx/dist/random.js"const r = Rects.random(weightedSource(`quadIn`)); Copy
import { Rects } from "https://unpkg.com/ixfx/dist/geometry.js";import { weightedSource } from "https://unpkg.com/ixfx/dist/random.js"const r = Rects.random(weightedSource(`quadIn`));
Optional
Returns a random positioned Rect on a 0..1 scale.
A custom source of randomness can be provided: