Apply uniform distribution with location jiggle #3
Loading…
Reference in a new issue
No description provided.
Delete branch "smiludon/grindr-always-online:smiludon-patch-1"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The code calculates distance using a uniform linear distribution:
let distance = rand::random_range(0.0..=max_meters);Because the area of a circle scales with the square of the radius, picking a random radius linearly results in a heavy concentration of points near the center origin. If an algorithm analyzes the cluster of requests, the spatial distribution will look like a highly artificial bullseye rather than realistic human drift.To achieve a uniform distribution across the 5 meter radius disk, the distance calculation must use the square root of a random float between 0 and 1:
let distance = max_meters * rand::random_range(0.0..=1.0_f64).sqrt();