erg/crates/erg_compiler/lib/pystd/random.d.er
2023-05-09 22:19:19 +09:00

14 lines
688 B
Python

.seed!: (a := Num, version := Int) => NoneType
.randbytes!: (n: Nat) => Bytes
.randrange!: (start: Int, stop := Int, step := Int) => Int
.randint!: (a: Int, b: Int) => Int
.getrandbits!: (k: Nat) => Nat
.choice!: |T: Type, S <: Sequence(T)|(seq: S) => T
# TODO: dependent length array type
.choices!: |T: Type, S <: Sequence(T)|(population: S, weights := [Nat; _] or NoneType, k := Nat) => [T; _]
# TODO: Sequence!
.shuffle!: |T: Type, S <: Sequence(T)|(seq: S) => NoneType
.sample!: |T: Type, S <: Sequence(T)|(population: S, k := Nat) => [T; _]
.random!: () => 0.0..1.0 # TODO: <1.0
.dep_uniform! = 'uniform': |A: Int, B: Int|(a: {A}, b: {B}) => A..B
.uniform!: (a: Int, b: Int) => Int