@@ -273,6 +273,11 @@ impl<'a> Unstructured<'a> {
273273 /// Do not use this to generate the size of a collection. Use
274274 /// `arbitrary_len` instead.
275275 ///
276+ /// The probability distribution of the return value is not necessarily uniform.
277+ ///
278+ /// Returns `range.start()`, not an error,
279+ /// if this `Unstructured` [is empty][Unstructured::is_empty].
280+ ///
276281 /// # Panics
277282 ///
278283 /// Panics if `range.start > range.end`. That is, the given range must be
@@ -377,8 +382,12 @@ impl<'a> Unstructured<'a> {
377382 ///
378383 /// This should only be used inside of `Arbitrary` implementations.
379384 ///
380- /// Returns an error if there is not enough underlying data to make a
381- /// choice or if no choices are provided.
385+ /// The probability distribution of choices is not necessarily uniform.
386+ ///
387+ /// Returns the first choice, not an error,
388+ /// if this `Unstructured` [is empty][Unstructured::is_empty].
389+ ///
390+ /// Returns an error if no choices are provided.
382391 ///
383392 /// # Examples
384393 ///
@@ -416,8 +425,12 @@ impl<'a> Unstructured<'a> {
416425 ///
417426 /// This should only be used inside of `Arbitrary` implementations.
418427 ///
419- /// Returns an error if there is not enough underlying data to make a
420- /// choice or if no choices are provided.
428+ /// The probability distribution of choices is not necessarily uniform.
429+ ///
430+ /// Returns the first choice, not an error,
431+ /// if this `Unstructured` [is empty][Unstructured::is_empty].
432+ ///
433+ /// Returns an error if no choices are provided.
421434 ///
422435 /// # Examples
423436 ///
@@ -449,6 +462,10 @@ impl<'a> Unstructured<'a> {
449462
450463 /// Choose a value in `0..len`.
451464 ///
465+ /// The probability distribution of return values is not necessarily uniform.
466+ ///
467+ /// Returns zero, not an error, if this `Unstructured` [is empty][Unstructured::is_empty].
468+ ///
452469 /// Returns an error if the `len` is zero.
453470 ///
454471 /// # Examples
@@ -492,7 +509,9 @@ impl<'a> Unstructured<'a> {
492509 Ok ( idx)
493510 }
494511
495- /// Generate a boolean according to the given ratio.
512+ /// Generate a boolean which is true with probability approximately the given ratio.
513+ ///
514+ /// Returns true, not an error, if this `Unstructured` [is empty][Unstructured::is_empty].
496515 ///
497516 /// # Panics
498517 ///
@@ -512,7 +531,7 @@ impl<'a> Unstructured<'a> {
512531 /// let mut u = Unstructured::new(&my_data);
513532 ///
514533 /// if u.ratio(5, 7)? {
515- /// // Take this branch 5/7 of the time.
534+ /// // Take this branch approximately 5/7 of the time.
516535 /// }
517536 /// # Ok(())
518537 /// # }
0 commit comments