Set random seeds where applicable

This commit is contained in:
Alexander Hess 2024-07-15 11:26:43 +02:00
commit f0d92ed229
Signed by: alexander
GPG key ID: 344EA5AB10D868E0
3 changed files with 82 additions and 48 deletions

View file

@ -1274,13 +1274,29 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Let us quickly generate some random data points and draw a scatter plot with [matplotlib <img height=\"12\" style=\"display: inline-block\" src=\"../static/link/to_plt.png\">](https://matplotlib.org/)'s [plt.scatter() <img height=\"12\" style=\"display: inline-block\" src=\"../static/link/to_plt.png\">](https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.scatter.html#matplotlib.pyplot.scatter) function."
"First, let's set the [np.random.seed() <img height=\"12\" style=\"display: inline-block\" src=\"../static/link/to_np.png\">](https://docs.python.org/3/library/random.html#random.seed) to make the random numbers *replicable* on separate runs of this notebook."
]
},
{
"cell_type": "code",
"execution_count": 44,
"metadata": {},
"outputs": [],
"source": [
"np.random.seed(42)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Then, let us quickly generate some random data points and draw a scatter plot with [matplotlib <img height=\"12\" style=\"display: inline-block\" src=\"../static/link/to_plt.png\">](https://matplotlib.org/)'s [plt.scatter() <img height=\"12\" style=\"display: inline-block\" src=\"../static/link/to_plt.png\">](https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.scatter.html#matplotlib.pyplot.scatter) function."
]
},
{
"cell_type": "code",
"execution_count": 45,
"metadata": {},
"outputs": [
{
"data": {
@ -1288,7 +1304,7 @@
"<matplotlib.collections.PathCollection at 0x7f008b235d00>"
]
},
"execution_count": 44,
"execution_count": 45,
"metadata": {},
"output_type": "execute_result"
},