File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -610,6 +610,11 @@ impl<R: Rng> RngUtil for R {
610
610
}
611
611
612
612
/// Create a random number generator with a default algorithm and seed.
613
+ ///
614
+ /// It returns the cryptographically-safest `Rng` algorithm currently
615
+ /// available in Rust. If you require a specifically seeded `Rng` for
616
+ /// consistency over time you should pick one algorithm and create the
617
+ /// `Rng` yourself.
613
618
pub fn rng ( ) -> IsaacRng {
614
619
IsaacRng :: new ( )
615
620
}
@@ -619,6 +624,8 @@ static RAND_SIZE: u32 = 1 << RAND_SIZE_LEN;
619
624
620
625
/// A random number generator that uses the [ISAAC
621
626
/// algorithm](http://en.wikipedia.org/wiki/ISAAC_%28cipher%29).
627
+ ///
628
+ /// The ISAAC algorithm is suitable for cryptographic purposes.
622
629
pub struct IsaacRng {
623
630
priv cnt: u32 ,
624
631
priv rsl: [ u32 , .. RAND_SIZE ] ,
@@ -794,8 +801,11 @@ impl Rng for IsaacRng {
794
801
}
795
802
796
803
/// An [Xorshift random number
797
- /// generator](http://en.wikipedia.org/wiki/Xorshift). Not suitable for
798
- /// cryptographic purposes.
804
+ /// generator](http://en.wikipedia.org/wiki/Xorshift).
805
+ ///
806
+ /// The Xorshift algorithm is not suitable for cryptographic purposes
807
+ /// but is very fast. If you do not know for sure that it fits your
808
+ /// requirements, use a more secure one such as `IsaacRng`.
799
809
pub struct XorShiftRng {
800
810
priv x: u32 ,
801
811
priv y: u32 ,
You can’t perform that action at this time.
0 commit comments