Skip to content

Instantly share code, notes, and snippets.

@tgzw
Created November 9, 2022 01:51
Show Gist options
  • Select an option

  • Save tgzw/d015991934e4e70dc3404ca31f839190 to your computer and use it in GitHub Desktop.

Select an option

Save tgzw/d015991934e4e70dc3404ca31f839190 to your computer and use it in GitHub Desktop.
Perlin noise in python using the perlin-noise package. 3-4 octaves seem to be the ideal.
# !pip install perlin-noise
import matplotlib.pyplot as plt
from perlin_noise import PerlinNoise
noise = PerlinNoise(octaves=3, seed=1)
xpix, ypix = 100, 100
pic = [[noise([i/xpix, j/ypix]) for j in range(xpix)] for i in range(ypix)]
plt.imshow(pic, cmap='gray')
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment