33//! The [`Random`] trait allows generating a random value for a type using a 
44//! given [`RandomSource`]. 
55
6- #[ unstable( feature = "random" ,  issue = "none " ) ]  
6+ #[ unstable( feature = "random" ,  issue = "130703 " ) ]  
77pub  use  core:: random:: * ; 
88
99use  crate :: sys:: random as  sys; 
@@ -15,9 +15,9 @@ use crate::sys::random as sys;
1515/// documentation below for the specific guarantees your target provides. 
1616/// 
1717/// The high quality of randomness provided by this source means it can be quite 
18- /// slow. If you need a large quantity of random numbers and security is not a  
19- /// concern,  consider using an alternative random number generator (potentially  
20- /// seeded from this one). 
18+ /// slow on some targets . If you need a large quantity of random numbers and 
19+ /// security is not a  concern,  consider using an alternative random number 
20+ /// generator (potentially  seeded from this one). 
2121/// 
2222/// # Underlying sources 
2323/// 
@@ -26,9 +26,9 @@ use crate::sys::random as sys;
2626/// Linux                  | [`getrandom`] or [`/dev/urandom`] after polling `/dev/random` 
2727/// Windows                | [`ProcessPrng`](https://learn.microsoft.com/en-us/windows/win32/seccng/processprng) 
2828/// Apple                  | `CCRandomGenerateBytes` 
29- /// DragonFly              | [`arc4random_buf`](https://man.dragonflybsd.org/?command=arc4random§ion=ANY ) 
29+ /// DragonFly              | [`arc4random_buf`](https://man.dragonflybsd.org/?command=arc4random) 
3030/// ESP-IDF                | [`esp_fill_random`](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/system/random.html#_CPPv415esp_fill_randomPv6size_t) 
31- /// FreeBSD                | [`arc4random_buf`](https://man.freebsd.org/cgi/man.cgi?query=arc4random&apropos=0&sektion=0&manpath=FreeBSD+15.0-CURRENT&arch=default&format=html ) 
31+ /// FreeBSD                | [`arc4random_buf`](https://man.freebsd.org/cgi/man.cgi?query=arc4random) 
3232/// Fuchsia                | [`cprng_draw`](https://fuchsia.dev/reference/syscalls/cprng_draw) 
3333/// Haiku                  | `arc4random_buf` 
3434/// Illumos                | [`arc4random_buf`](https://www.illumos.org/man/3C/arc4random) 
@@ -48,15 +48,19 @@ use crate::sys::random as sys;
4848/// WASI                   | [`random_get`](https://github.com/WebAssembly/WASI/blob/main/legacy/preview1/docs.md#-random_getbuf-pointeru8-buf_len-size---result-errno) 
4949/// ZKVM                   | `sys_rand` 
5050/// 
51- /// **Disclaimer:** The sources used might change over time. 
51+ /// Note that the sources used might change over time. 
52+ /// 
53+ /// Consult the documentation for the underlying operations on your supported 
54+ /// targets to determine whether they provide any particular desired properties, 
55+ /// such as support for reseeding on VM fork operations. 
5256/// 
5357/// [`getrandom`]: https://www.man7.org/linux/man-pages/man2/getrandom.2.html 
5458/// [`/dev/urandom`]: https://www.man7.org/linux/man-pages/man4/random.4.html 
5559#[ derive( Default ,  Debug ,  Clone ,  Copy ) ]  
56- #[ unstable( feature = "random" ,  issue = "none " ) ]  
60+ #[ unstable( feature = "random" ,  issue = "130703 " ) ]  
5761pub  struct  DefaultRandomSource ; 
5862
59- #[ unstable( feature = "random" ,  issue = "none " ) ]  
63+ #[ unstable( feature = "random" ,  issue = "130703 " ) ]  
6064impl  RandomSource  for  DefaultRandomSource  { 
6165    fn  fill_bytes ( & mut  self ,  bytes :  & mut  [ u8 ] )  { 
6266        sys:: fill_bytes ( bytes) 
@@ -83,7 +87,7 @@ impl RandomSource for DefaultRandomSource {
8387/// 
8488/// use std::random::random; 
8589/// 
86- /// let bits  = random::<u128> (); 
90+ /// let bits: u128  = random(); 
8791/// let g1 = (bits >> 96) as u32; 
8892/// let g2 = (bits >> 80) as u16; 
8993/// let g3 = (0x4000 | (bits >> 64) & 0x0fff) as u16; 
@@ -94,6 +98,7 @@ impl RandomSource for DefaultRandomSource {
9498/// ``` 
9599/// 
96100/// [version 4/variant 1 UUID]: https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_4_(random) 
101+ #[ unstable( feature = "random" ,  issue = "130703" ) ]  
97102pub  fn  random < T :  Random > ( )  -> T  { 
98103    T :: random ( & mut  DefaultRandomSource ) 
99104} 
0 commit comments