Change docstring to match the trait bound

This commit is contained in:
Henry de Valence 2017-05-02 21:22:04 -07:00
parent 6ea1d4dad2
commit 91e11b6318

View file

@ -144,21 +144,19 @@ impl CTAssignable for Scalar {
} }
impl Scalar { impl Scalar {
/// Return a `Scalar` chosen uniformly at random using a CSPRNG. /// Return a `Scalar` chosen uniformly at random using a user-provided RNG.
/// Panics if the operating system's CSPRNG is unavailable.
/// ///
/// # Inputs /// # Inputs
/// ///
/// * `cspring`: any cryptographically secure PRNG which /// * `rng`: any RNG which implements the `rand::Rng` interface.
/// implements the `rand::Rng` interface.
/// ///
/// # Returns /// # Returns
/// ///
/// A random scalar within /l. /// A random scalar within /l.
#[cfg(feature = "std")] #[cfg(feature = "std")]
pub fn random<T: Rng>(csprng: &mut T) -> Self { pub fn random<T: Rng>(rng: &mut T) -> Self {
let mut scalar_bytes = [0u8; 64]; let mut scalar_bytes = [0u8; 64];
csprng.fill_bytes(&mut scalar_bytes); rng.fill_bytes(&mut scalar_bytes);
Scalar::reduce(&scalar_bytes) Scalar::reduce(&scalar_bytes)
} }