-
-
Notifications
You must be signed in to change notification settings - Fork 483
Closed
Labels
B-APIBreakage: APIBreakage: APIF-new-intFunctionality: new, within RandFunctionality: new, within Rand
Description
Summary:
- deprecate
gen_iterandgen_ascii_chars - possibly move
shuffle,chooseandchoose_mut: topic of Sequence sampling:seq,WeightedChoicedhardy/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 useRngCorefor itsfill_bytessample(distribution)— alternative todistribution.sample(rng); possibly not very usefulgen()— sample anything supporting theUniformdistribution; @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 fromRngand 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_iterandgen_ascii_charsare being removedshufflemay be removedsampleandgencould 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