Orta Seviye Python
Hugo Bowne-Anderson
Data Scientist at DataCamp






import numpy as np
np.random.rand() # Sözde rastgele sayılar
0.9535543896720104 # Matematiksel formül
np.random.seed(123) # Bir tohumdan başlamak
np.random.rand()
0.6964691855978616
np.random.rand()
0.28613933495037946
np.random.seed(123)
np.random.rand()
0.696469185597861 # Aynı tohum: aynı rastgele sayılar!
np.random.rand() # "yeniden üretilebilirlik" sağlar
0.28613933495037946
game.py
import numpy as npnp.random.seed(123)coin = np.random.randint(0,2) # Rastgele 0 veya 1 üretirprint(coin)
0
game.py
import numpy as np np.random.seed(123) coin = np.random.randint(0,2) # Rastgele 0 veya 1 üretir print(coin)if coin == 0: print("heads")else: print("tails")
0
heads
Orta Seviye Python