Skip to content

Instantly share code, notes, and snippets.

@zheng95z
Last active March 31, 2022 17:49
Show Gist options
  • Save zheng95z/2f1458bee8f054ad776ea55a6aa2f23c to your computer and use it in GitHub Desktop.
Save zheng95z/2f1458bee8f054ad776ea55a6aa2f23c to your computer and use it in GitHub Desktop.
[Random sampling in numpy] #numpy
"""
Reference:
https://numpy.org/doc/stable/reference/random/generator.html
"""
import numpy as np
# Get Random Generator and set seed for reproducibility
rng = np.random.default_rng(114514)
# Draw samples from a uniform distribution
samples = rng.uniform(low=0.0, high=1.0, size=(16, 16))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment