35 lines
811 B
Python
35 lines
811 B
Python
#!/usr/bin/env python3
|
|
# -*- coding: utf-8 -*-
|
|
"""
|
|
Created on Thu Aug 29 23:53:47 2019
|
|
|
|
@author: mysaa
|
|
"""
|
|
|
|
import numpy as np
|
|
import matplotlib.pyplot as pp
|
|
import random as rnd
|
|
import perlin
|
|
|
|
|
|
N = 42
|
|
values = []
|
|
pp.xlabel('valeur')
|
|
pp.ylabel('compte')
|
|
pp.title('Valeur du bruit de perlin')
|
|
|
|
#tt = np.vectorize(lambda x : x//0.01)
|
|
|
|
noise = perlin.PerlinNoise(2.3,42)#,wrapper = lambda x : np.tanh(x*3.8622))
|
|
while True:
|
|
#print("\r{}".format(i), end='\r')
|
|
for _ in range(N):
|
|
chunk = noise.getChunk(rnd.randint(0,167342),rnd.randint(0,941132),(16,16))
|
|
values += np.reshape(chunk, (1,256))[0].tolist()
|
|
[n,X, V]=pp.hist(values,range=(-1,1),bins=201,log=True, color = '#2aff00',edgecolor = 'black')
|
|
pp.draw()
|
|
pp.pause(0.1)
|
|
|
|
#pp.figure()
|
|
#X = np.linspace(-1,1,2000)
|
|
#pp.plot(X,X) |