November 2024
Intermediate to advanced
200 pages
5h 22m
English
Edwin S. Dalmaijer
After learning about all those variable types, it’s time to do something cooler! In this random intermezzo, you will learn how to make visual noise.
In the previous chapters, you learned how to use NumPy arrays. But there is more to NumPy than just array calculations! There is a beautiful random module that allows you to generate random numbers:
import numpy numpy.random.rand() numpy.random.rand() numpy.random.rand()
Just try it a few times, to make sure the numbers are actually random. If you do recognise a pattern, you might actually be right. A computer’s random numbers are produced by an algorithm that depends on a fixed number, a seed. You can provide your ...
Read now
Unlock full access