@@ -44,7 +44,7 @@ pub struct SessionSecretRand([u8; 32]);
4444impl SessionSecretRand {
4545 /// Generates a new session ID using thread RNG.
4646 #[ cfg( all( feature = "rand" , feature = "std" ) ) ]
47- pub fn new ( ) -> Self { Self :: from_rng ( & mut rand:: thread_rng ( ) ) }
47+ pub fn new ( ) -> Self { Self :: from_rng ( & mut rand:: rng ( ) ) }
4848
4949 /// Creates a new [`SessionSecretRand`] with random bytes from the given rng
5050 #[ cfg( feature = "rand" ) ]
@@ -142,12 +142,12 @@ impl fmt::Display for InvalidTweakErr {
142142///
143143/// ```rust
144144/// # # [cfg(any(test, feature = "rand-std"))] {
145- /// # use secp256k1::rand::{thread_rng , RngCore};
145+ /// # use secp256k1::rand::{rng , RngCore};
146146/// # use secp256k1::{PublicKey, Secp256k1, SecretKey, new_nonce_pair, SessionSecretRand};
147147/// # let secp = Secp256k1::new();
148148/// // The session id must be sampled at random. Read documentation for more details.
149- /// let session_secrand = SessionSecretRand::new(&mut thread_rng ());
150- /// let sk = SecretKey::new(&mut thread_rng ());
149+ /// let session_secrand = SessionSecretRand::new(&mut rng ());
150+ /// let sk = SecretKey::new(&mut rng ());
151151/// let pk = PublicKey::from_secret_key(&secp, &sk);
152152///
153153/// // Supply extra auxillary randomness to prevent misuse(for example, time of day)
@@ -298,12 +298,12 @@ impl KeyAggCache {
298298 ///
299299 /// ```rust
300300 /// # # [cfg(any(test, feature = "rand-std"))] {
301- /// # use secp256k1::rand::{thread_rng , RngCore};
301+ /// # use secp256k1::rand::{rng , RngCore};
302302 /// # use secp256k1::{KeyAggCache, Secp256k1, SecretKey, Keypair, PublicKey};
303303 /// # let secp = Secp256k1::new();
304- /// # let sk1 = SecretKey::new(&mut thread_rng ());
304+ /// # let sk1 = SecretKey::new(&mut rng ());
305305 /// # let pub_key1 = PublicKey::from_secret_key(&secp, &sk1);
306- /// # let sk2 = SecretKey::new(&mut thread_rng ());
306+ /// # let sk2 = SecretKey::new(&mut rng ());
307307 /// # let pub_key2 = PublicKey::from_secret_key(&secp, &sk2);
308308 /// #
309309 /// let key_agg_cache = KeyAggCache::new(&secp, &[pub_key1, pub_key2]);
@@ -387,12 +387,12 @@ impl KeyAggCache {
387387 ///
388388 /// ```rust
389389 /// # # [cfg(any(test, feature = "rand-std"))] {
390- /// # use secp256k1::rand::{thread_rng , RngCore};
390+ /// # use secp256k1::rand::{rng , RngCore};
391391 /// # use secp256k1::{KeyAggCache, Secp256k1, SecretKey, Keypair, PublicKey};
392392 /// # let secp = Secp256k1::new();
393- /// # let sk1 = SecretKey::new(&mut thread_rng ());
393+ /// # let sk1 = SecretKey::new(&mut rng ());
394394 /// # let pub_key1 = PublicKey::from_secret_key(&secp, &sk1);
395- /// # let sk2 = SecretKey::new(&mut thread_rng ());
395+ /// # let sk2 = SecretKey::new(&mut rng ());
396396 /// # let pub_key2 = PublicKey::from_secret_key(&secp, &sk2);
397397 /// #
398398 /// let mut key_agg_cache = KeyAggCache::new(&secp, &[pub_key1, pub_key2]);
@@ -446,12 +446,12 @@ impl KeyAggCache {
446446 ///
447447 /// ```rust
448448 /// # # [cfg(any(test, feature = "rand-std"))] {
449- /// # use secp256k1::rand::{thread_rng , RngCore};
449+ /// # use secp256k1::rand::{rng , RngCore};
450450 /// # use secp256k1::{KeyAggCache, Secp256k1, SecretKey, Keypair, PublicKey};
451451 /// # let secp = Secp256k1::new();
452- /// # let sk1 = SecretKey::new(&mut thread_rng ());
452+ /// # let sk1 = SecretKey::new(&mut rng ());
453453 /// # let pub_key1 = PublicKey::from_secret_key(&secp, &sk1);
454- /// # let sk2 = SecretKey::new(&mut thread_rng ());
454+ /// # let sk2 = SecretKey::new(&mut rng ());
455455 /// # let pub_key2 = PublicKey::from_secret_key(&secp, &sk2);
456456 ///
457457 /// let mut key_agg_cache = KeyAggCache::new(&secp, &[pub_key1, pub_key2]);
@@ -520,17 +520,17 @@ impl KeyAggCache {
520520 ///
521521 /// ```rust
522522 /// # # [cfg(any(test, feature = "rand-std"))] {
523- /// # use secp256k1::rand::{thread_rng , RngCore};
523+ /// # use secp256k1::rand::{rng , RngCore};
524524 /// # use secp256k1::{KeyAggCache, Secp256k1, SecretKey, Keypair, PublicKey, SessionSecretRand, Message};
525525 /// # let secp = Secp256k1::new();
526- /// # let sk1 = SecretKey::new(&mut thread_rng ());
526+ /// # let sk1 = SecretKey::new(&mut rng ());
527527 /// # let pub_key1 = PublicKey::from_secret_key(&secp, &sk1);
528- /// # let sk2 = SecretKey::new(&mut thread_rng ());
528+ /// # let sk2 = SecretKey::new(&mut rng ());
529529 /// # let pub_key2 = PublicKey::from_secret_key(&secp, &sk2);
530530 /// #
531531 /// let key_agg_cache = KeyAggCache::new(&secp, &[pub_key1, pub_key2]);
532532 /// // The session id must be sampled at random. Read documentation for more details.
533- /// let session_secrand = SessionSecretRand::new(&mut thread_rng ());
533+ /// let session_secrand = SessionSecretRand::new(&mut rng ());
534534 ///
535535 /// let msg = Message::from_digest_slice(b"Public Message we want to sign!!").unwrap();
536536 ///
@@ -708,25 +708,25 @@ impl AggregatedNonce {
708708 ///
709709 /// ```rust
710710 /// # # [cfg(any(test, feature = "rand-std"))] {
711- /// # use secp256k1::rand::{thread_rng , RngCore};
711+ /// # use secp256k1::rand::{rng , RngCore};
712712 /// # use secp256k1::{KeyAggCache, Secp256k1, SecretKey, Keypair, PublicKey, SessionSecretRand, Message, AggregatedNonce};
713713 /// # let secp = Secp256k1::new();
714- /// # let sk1 = SecretKey::new(&mut thread_rng ());
714+ /// # let sk1 = SecretKey::new(&mut rng ());
715715 /// # let pub_key1 = PublicKey::from_secret_key(&secp, &sk1);
716- /// # let sk2 = SecretKey::new(&mut thread_rng ());
716+ /// # let sk2 = SecretKey::new(&mut rng ());
717717 /// # let pub_key2 = PublicKey::from_secret_key(&secp, &sk2);
718718 ///
719719 /// # let key_agg_cache = KeyAggCache::new(&secp, &[pub_key1, pub_key2]);
720720 /// // The session id must be sampled at random. Read documentation for more details.
721721 ///
722722 /// let msg = Message::from_digest_slice(b"Public Message we want to sign!!").unwrap();
723723 ///
724- /// let session_secrand1 = SessionSecretRand::new(&mut thread_rng ());
724+ /// let session_secrand1 = SessionSecretRand::new(&mut rng ());
725725 /// let (_sec_nonce1, pub_nonce1) = key_agg_cache.nonce_gen(&secp, session_secrand1, pub_key1, msg, None)
726726 /// .expect("non zero session id");
727727 ///
728728 /// // Signer two does the same: Possibly on a different device
729- /// let session_secrand2 = SessionSecretRand::new(&mut thread_rng ());
729+ /// let session_secrand2 = SessionSecretRand::new(&mut rng ());
730730 /// let (_sec_nonce2, pub_nonce2) = key_agg_cache.nonce_gen(&secp, session_secrand2, pub_key2, msg, None)
731731 /// .expect("non zero session id");
732732 ///
@@ -870,12 +870,12 @@ impl Session {
870870 ///
871871 /// ```rust
872872 /// # # [cfg(any(test, feature = "rand-std"))] {
873- /// # use secp256k1::rand::{thread_rng , RngCore};
873+ /// # use secp256k1::rand::{rng , RngCore};
874874 /// # use secp256k1::{KeyAggCache, Secp256k1, SecretKey, Keypair, PublicKey, SessionSecretRand, Message, AggregatedNonce, Session};
875875 /// # let secp = Secp256k1::new();
876- /// # let sk1 = SecretKey::new(&mut thread_rng ());
876+ /// # let sk1 = SecretKey::new(&mut rng ());
877877 /// # let pub_key1 = PublicKey::from_secret_key(&secp, &sk1);
878- /// # let sk2 = SecretKey::new(&mut thread_rng ());
878+ /// # let sk2 = SecretKey::new(&mut rng ());
879879 /// # let pub_key2 = PublicKey::from_secret_key(&secp, &sk2);
880880 ///
881881 /// # let key_agg_cache = KeyAggCache::new(&secp, &[pub_key1, pub_key2]);
@@ -884,13 +884,13 @@ impl Session {
884884 /// let msg = Message::from_digest_slice(b"Public Message we want to sign!!").unwrap();
885885 ///
886886 /// // Provide the current time for mis-use resistance
887- /// let session_secrand1 = SessionSecretRand::new(&mut thread_rng ());
887+ /// let session_secrand1 = SessionSecretRand::new(&mut rng ());
888888 /// let extra_rand1 : Option<[u8; 32]> = None;
889889 /// let (_sec_nonce1, pub_nonce1) = key_agg_cache.nonce_gen(&secp, session_secrand1, pub_key1, msg, extra_rand1)
890890 /// .expect("non zero session id");
891891 ///
892892 /// // Signer two does the same. Possibly on a different device
893- /// let session_secrand2 = SessionSecretRand::new(&mut thread_rng ());
893+ /// let session_secrand2 = SessionSecretRand::new(&mut rng ());
894894 /// let extra_rand2 : Option<[u8; 32]> = None;
895895 /// let (_sec_nonce2, pub_nonce2) = key_agg_cache.nonce_gen(&secp, session_secrand2, pub_key2, msg, extra_rand2)
896896 /// .expect("non zero session id");
@@ -1006,12 +1006,12 @@ impl Session {
10061006 ///
10071007 /// ```rust
10081008 /// # # [cfg(any(test, feature = "rand-std"))] {
1009- /// # use secp256k1::rand::{thread_rng , RngCore};
1009+ /// # use secp256k1::rand::{rng , RngCore};
10101010 /// # use secp256k1::{KeyAggCache, Secp256k1, SecretKey, Keypair, PublicKey, SessionSecretRand, Message, AggregatedNonce, Session};
10111011 /// # let secp = Secp256k1::new();
1012- /// # let sk1 = SecretKey::new(&mut thread_rng ());
1012+ /// # let sk1 = SecretKey::new(&mut rng ());
10131013 /// # let pub_key1 = PublicKey::from_secret_key(&secp, &sk1);
1014- /// # let sk2 = SecretKey::new(&mut thread_rng ());
1014+ /// # let sk2 = SecretKey::new(&mut rng ());
10151015 /// # let pub_key2 = PublicKey::from_secret_key(&secp, &sk2);
10161016 ///
10171017 /// # let key_agg_cache = KeyAggCache::new(&secp, &[pub_key1, pub_key2]);
@@ -1020,12 +1020,12 @@ impl Session {
10201020 /// let msg = Message::from_digest_slice(b"Public Message we want to sign!!").unwrap();
10211021 ///
10221022 /// // Provide the current time for mis-use resistance
1023- /// let session_secrand1 = SessionSecretRand::new(&mut thread_rng ());
1023+ /// let session_secrand1 = SessionSecretRand::new(&mut rng ());
10241024 /// let (mut sec_nonce1, pub_nonce1) = key_agg_cache.nonce_gen(&secp, session_secrand1, pub_key1, msg, None)
10251025 /// .expect("non zero session id");
10261026 ///
10271027 /// // Signer two does the same. Possibly on a different device
1028- /// let session_secrand2 = SessionSecretRand::new(&mut thread_rng ());
1028+ /// let session_secrand2 = SessionSecretRand::new(&mut rng ());
10291029 /// let (_sec_nonce2, pub_nonce2) = key_agg_cache.nonce_gen(&secp, session_secrand2, pub_key2, msg, None)
10301030 /// .expect("non zero session id");
10311031 ///
@@ -1089,12 +1089,12 @@ impl Session {
10891089 ///
10901090 /// ```rust
10911091 /// # # [cfg(any(test, feature = "rand-std"))] {
1092- /// # use secp256k1::rand::{thread_rng , RngCore};
1092+ /// # use secp256k1::rand::{rng , RngCore};
10931093 /// # use secp256k1::{KeyAggCache, Secp256k1, SecretKey, Keypair, PublicKey, SessionSecretRand, Message, AggregatedNonce, Session};
10941094 /// # let secp = Secp256k1::new();
1095- /// # let sk1 = SecretKey::new(&mut thread_rng ());
1095+ /// # let sk1 = SecretKey::new(&mut rng ());
10961096 /// # let pub_key1 = PublicKey::from_secret_key(&secp, &sk1);
1097- /// # let sk2 = SecretKey::new(&mut thread_rng ());
1097+ /// # let sk2 = SecretKey::new(&mut rng ());
10981098 /// # let pub_key2 = PublicKey::from_secret_key(&secp, &sk2);
10991099 ///
11001100 /// let key_agg_cache = KeyAggCache::new(&secp, &[pub_key1, pub_key2]);
@@ -1103,12 +1103,12 @@ impl Session {
11031103 /// let msg = Message::from_digest_slice(b"Public Message we want to sign!!").unwrap();
11041104 ///
11051105 /// // Provide the current time for mis-use resistance
1106- /// let session_secrand1 = SessionSecretRand::new(&mut thread_rng ());
1106+ /// let session_secrand1 = SessionSecretRand::new(&mut rng ());
11071107 /// let (mut sec_nonce1, pub_nonce1) = key_agg_cache.nonce_gen(&secp, session_secrand1, pub_key1, msg, None)
11081108 /// .expect("non zero session id");
11091109 ///
11101110 /// // Signer two does the same. Possibly on a different device
1111- /// let session_secrand2 = SessionSecretRand::new(&mut thread_rng ());
1111+ /// let session_secrand2 = SessionSecretRand::new(&mut rng ());
11121112 /// let (mut sec_nonce2, pub_nonce2) = key_agg_cache.nonce_gen(&secp, session_secrand2, pub_key2, msg, None)
11131113 /// .expect("non zero session id");
11141114 ///
0 commit comments