📘
Random Arrays
EasyNumPy Random
Problem Statement
Generate random arrays with specific properties.
Background
NumPy's random module provides:
- np.random.seed(n) - for reproducibility
- np.random.rand(m, n) - uniform [0, 1)
- np.random.randn(m, n) - standard normal
- np.random.randint(low, high, size) - integers
Your Task
Write a function random_arrays(rows, cols, seed) that creates random arrays.
Important: Set the seed at the start using np.random.seed(seed).
Output Format
Return a dictionary with:
- "uniform": Uniform random (rounded to 2 decimals)
- "normal": Normal distribution (rounded to 2 decimals)
- "integers": Random integers from 0-9
Example:
Input:
rows=2, cols=3, seed=42
Output:
Arrays with reproducible random values
Reasoning:
np.random.seed(42) ensures reproducible results
Constraints:
- Always set seed first
- Round floats to 2 decimal places
- Integer range is 0-9 (inclusive)
Editor
Python 3.13.1
Test Results
0/0Run code to see test results.