stdlib
stdlib copied to clipboard
Function to take a number of random values from a list
trafficstars
I started looking at the state of random in Gleam and I have several ideas.
int.randomandfloat.randomdo not have seeds. It might be a problem for libraries. For example: if you want a fake-data library for tests: you need to have the same data based on some test seed value. Otherwise, you won't have reproducable failures. https://docs.python.org/3/library/random.html#notes-on-reproducibility- There's no
int.random_range(x, y)function, which would generate an int from range>=x, <y. I think that this function is essential - There's no
choice(List)function, which in my experience is the second most frequently used random function in Python.
Maybe we should add random module with the needed functions and a nice api for Seed(Int)?