-
-
Notifications
You must be signed in to change notification settings - Fork 475
Closed
Labels
B-APIBreakage: APIBreakage: APIF-new-intFunctionality: new, within RandFunctionality: new, within Rand
Description
Summary:
- deprecate
gen_iter
andgen_ascii_chars
- possibly move
shuffle
,choose
andchoose_mut
: topic of Sequence sampling:seq
,WeightedChoice
dhardy/rand#82 - deprecate
gen_weighted_bool
- add
gen_bool
- no other changes (@vks disagrees on this, but seems to be alone)
Original post:
Rng
has:
fill(dest)
,try_fill(dest)
— will slices/arrays; mostly added to avoid need to useRngCore
for itsfill_bytes
sample(distribution)
— alternative todistribution.sample(rng)
; possibly not very usefulgen()
— sample anything supporting theUniform
distribution; @clarcharr suggested removing this but I don't think that is likelygen_iter()
,gen_ascii_chars()
— deprecatedgen_range(low, high)
— shortcut forRange::sample_single(low, high, rng)
; probably worth keepinggen_weighted_bool(n)
— simple extension ofgen_range()
; likely not used massively but simple and clear, so I don't see a motive to removechoose(slice)
,choose_mut(slice)
— get a ref to a random element; simple and somewhat usefulshuffle(slice)
— shuffling algorithm; since this is an actual algorithm and not so directly related to RNGs it may be better removing fromRng
and adding some shuffle trait instead (allowingslice.shuffle(rng)
)
Possible additions:
p(p)
/chance(p)
/gen_bernoulli(p)
— sample a boolean with given chance (i.e. roughlyrng.gen() < p
, but we might implement a distribution with more accurate sampling for smallp
)
Summary (suggested changes):
gen_iter
andgen_ascii_chars
are being removedshuffle
may be removedsample
andgen
could be removed, but less likely- a method to sample booleans may be added
schneiderfelipe
Metadata
Metadata
Assignees
Labels
B-APIBreakage: APIBreakage: APIF-new-intFunctionality: new, within RandFunctionality: new, within Rand