Skip to content

Commit 54a67a6

Browse files
committed
Add PRNG with fix seed for reproducibility
1 parent a293146 commit 54a67a6

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

examples/api/engineering_formatter.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,15 @@
77

88
from matplotlib.ticker import EngFormatter
99

10+
prng = np.random.RandomState(123)
11+
1012
fig, ax = plt.subplots()
1113
ax.set_xscale('log')
1214
formatter = EngFormatter(unit='Hz')
1315
ax.xaxis.set_major_formatter(formatter)
1416

1517
xs = np.logspace(1, 9, 100)
16-
ys = (0.8 + 0.4*np.random.uniform(size=100))*np.log10(xs)**2
18+
ys = (0.8 + 0.4 * prng.uniform(size=100)) * np.log10(xs)**2
1719
ax.plot(xs, ys)
1820

1921
plt.show()

0 commit comments

Comments
 (0)