Skip to content

Instantly share code, notes, and snippets.

@willwybrow
willwybrow / terrain_boundaries.py
Created April 24, 2017 09:53
Python file to take a normal random point and select a place within a not-normal weighted set of regions
import numpy as np
def weightedly_distribute_and_scale_noise_point(region_boundaries, region_weights, noise_point):
"""
region_boundaries are n points within the region, starting with the min and ending at the max, forming n-1 buckets
region_weights is a list of weights that should be length n-1, this will determine what % of points fall here
noise_point should be between -1.0 and 1.0
"""
normalised_noise_point = (noise_point + 1.0)/2.0

Keybase proof

I hereby claim:

  • I am willwybrow on github.
  • I am willwybrow (https://keybase.io/willwybrow) on keybase.
  • I have a public key whose fingerprint is 6832 413A D157 2427 7F4C 930A 85C3 B183 B77B AD23

To claim this, I am signing this object: