Skip to content
C

Problem 1: Generate Reproducible Random Data

Easypython

Problem Description

Write a Python program that uses np.random.default_rng() with a fixed seed to generate 5 random numbers, and confirms that running it twice produces identical results.

Input

A seed value.

Output

The generated random numbers from two separate runs, showing they match.

Constraints

  • Use the same seed both times.

Example Input

text
seed=42

Example Output

text
Run 1: [0.305 -1.04 0.75 0.94 -1.95] Run 2: [0.305 -1.04 0.75 0.94 -1.95] Match: True

Concepts Covered

np.random.default_rng(), reproducibility.

Input (stdin)

Output

Run your code to see output here...