Codebase list rust-stfu8 / bd18351
Update num-bigint kpcyrd 4 years ago
6 changed file(s) with 247 addition(s) and 5 deletion(s). Raw diff Collapse all Expand all
0 rust-num-bigint (0.2.3-1) UNRELEASED-FIXME-AUTOGENERATED-DEBCARGO; urgency=medium
1
2 * Package num-bigint 0.2.3 from crates.io using debcargo 2.4.0
3
4 -- kpcyrd <git@rxv.cc> Sat, 7 Sep 2019 13:59:49 +0200
5
06 rust-num-bigint (0.2.0-1) unstable; urgency=medium
17
28 * Package num-bigint 0.2.0 from crates.io using debcargo 2.2.6
33 Source: https://github.com/rust-num/num-bigint
44
55 Files: *
6 Copyright: 2013-2018 The Rust Project Developers
6 Copyright: 2013-2019 The Rust Project Developers
77 License: MIT or Apache-2.0
88
99 Files: debian/*
1010 Copyright:
11 2018 Debian Rust Maintainers <pkg-rust-maintainers@alioth-lists.debian.net>
12 2018 kpcyrd <git@rxv.cc>
11 2018-2019 Debian Rust Maintainers <pkg-rust-maintainers@alioth-lists.debian.net>
12 2018-2019 kpcyrd <git@rxv.cc>
1313 License: MIT or Apache-2.0
1414
1515 License: Apache-2.0
3434
3535 Files: debian/*
3636 Copyright:
37 2018 Debian Rust Maintainers <pkg-rust-maintainers@alioth-lists.debian.net>
38 2018 kpcyrd <git@rxv.cc>
37 2018-2019 Debian Rust Maintainers <pkg-rust-maintainers@alioth-lists.debian.net>
38 2018-2019 kpcyrd <git@rxv.cc>
3939 License: MIT or Apache-2.0
4040
4141 License: Apache-2.0
0 diff --git a/src/bigrand.rs b/src/bigrand.rs
1 index 4a13b29..d0ff2e0 100644
2 --- a/src/bigrand.rs
3 +++ b/src/bigrand.rs
4 @@ -1,6 +1,6 @@
5 //! Randomization of big integers
6
7 -use rand::distributions::uniform::{SampleUniform, UniformSampler};
8 +use rand::distributions::uniform::{SampleUniform, UniformSampler, SampleBorrow};
9 use rand::prelude::*;
10 use rand::AsByteSliceMut;
11
12 @@ -121,16 +121,26 @@ impl UniformSampler for UniformBigUint {
13 type X = BigUint;
14
15 #[inline]
16 - fn new(low: Self::X, high: Self::X) -> Self {
17 + fn new<B1, B2>(low_b: B1, high_b: B2) -> Self
18 + where B1: SampleBorrow<Self::X> + Sized,
19 + B2: SampleBorrow<Self::X> + Sized
20 + {
21 + let low = low_b.borrow();
22 + let high = high_b.borrow();
23 assert!(low < high);
24 UniformBigUint {
25 - len: high - &low,
26 - base: low,
27 + len: high - low,
28 + base: low.clone(),
29 }
30 }
31
32 #[inline]
33 - fn new_inclusive(low: Self::X, high: Self::X) -> Self {
34 + fn new_inclusive<B1, B2>(low_b: B1, high_b: B2) -> Self
35 + where B1: SampleBorrow<Self::X> + Sized,
36 + B2: SampleBorrow<Self::X> + Sized
37 + {
38 + let low = low_b.borrow();
39 + let high = high_b.borrow();
40 assert!(low <= high);
41 Self::new(low, high + 1u32)
42 }
43 @@ -141,8 +151,11 @@ impl UniformSampler for UniformBigUint {
44 }
45
46 #[inline]
47 - fn sample_single<R: Rng + ?Sized>(low: Self::X, high: Self::X, rng: &mut R) -> Self::X {
48 - rng.gen_biguint_range(&low, &high)
49 + fn sample_single<R: Rng + ?Sized, B1, B2>(low: B1, high: B2, rng: &mut R) -> Self::X
50 + where B1: SampleBorrow<Self::X> + Sized,
51 + B2: SampleBorrow<Self::X> + Sized
52 + {
53 + rng.gen_biguint_range(low.borrow(), high.borrow())
54 }
55 }
56
57 @@ -161,16 +174,26 @@ impl UniformSampler for UniformBigInt {
58 type X = BigInt;
59
60 #[inline]
61 - fn new(low: Self::X, high: Self::X) -> Self {
62 + fn new<B1, B2>(low_b: B1, high_b: B2) -> Self
63 + where B1: SampleBorrow<Self::X> + Sized,
64 + B2: SampleBorrow<Self::X> + Sized
65 + {
66 + let low = low_b.borrow();
67 + let high = high_b.borrow();
68 assert!(low < high);
69 UniformBigInt {
70 - len: into_magnitude(high - &low),
71 - base: low,
72 + len: into_magnitude(high - low),
73 + base: low.clone(),
74 }
75 }
76
77 #[inline]
78 - fn new_inclusive(low: Self::X, high: Self::X) -> Self {
79 + fn new_inclusive<B1, B2>(low_b: B1, high_b: B2) -> Self
80 + where B1: SampleBorrow<Self::X> + Sized,
81 + B2: SampleBorrow<Self::X> + Sized
82 + {
83 + let low = low_b.borrow();
84 + let high = high_b.borrow();
85 assert!(low <= high);
86 Self::new(low, high + 1u32)
87 }
88 @@ -181,8 +204,11 @@ impl UniformSampler for UniformBigInt {
89 }
90
91 #[inline]
92 - fn sample_single<R: Rng + ?Sized>(low: Self::X, high: Self::X, rng: &mut R) -> Self::X {
93 - rng.gen_bigint_range(&low, &high)
94 + fn sample_single<R: Rng + ?Sized, B1, B2>(low: B1, high: B2, rng: &mut R) -> Self::X
95 + where B1: SampleBorrow<Self::X> + Sized,
96 + B2: SampleBorrow<Self::X> + Sized
97 + {
98 + rng.gen_bigint_range(low.borrow(), high.borrow())
99 }
100 }
101
102 diff --git a/tests/bigint.rs b/tests/bigint.rs
103 index 911bff0..59c8793 100644
104 --- a/tests/bigint.rs
105 +++ b/tests/bigint.rs
106 @@ -1093,7 +1093,7 @@ fn test_negative_shr() {
107 fn test_random_shr() {
108 use rand::distributions::Standard;
109 use rand::Rng;
110 - let mut rng = rand::thread_rng();
111 + let rng = rand::thread_rng();
112
113 for p in rng.sample_iter::<i64, _>(&Standard).take(1000) {
114 let big = BigInt::from(p);
115 diff --git a/tests/rand.rs b/tests/rand.rs
116 index 666b764..fb84b1f 100644
117 --- a/tests/rand.rs
118 +++ b/tests/rand.rs
119 @@ -3,6 +3,9 @@
120 extern crate num_bigint;
121 extern crate num_traits;
122 extern crate rand;
123 +extern crate rand_chacha;
124 +extern crate rand_isaac;
125 +extern crate rand_xorshift;
126
127 mod biguint {
128 use num_bigint::{BigUint, RandBigInt, RandomBits};
129 @@ -118,7 +121,7 @@ mod biguint {
130 "57401636903146945411652549098818446911814352529449356393690984105383482703074355\
131 67088360974672291353736011718191813678720755501317478656550386324355699624671",
132 ];
133 - use rand::prng::ChaChaRng;
134 + use rand_chacha::ChaChaRng;
135 seeded_value_stability::<ChaChaRng>(EXPECTED);
136 }
137
138 @@ -137,7 +140,7 @@ mod biguint {
139 "37805949268912387809989378008822038725134260145886913321084097194957861133272558\
140 43458183365174899239251448892645546322463253898288141861183340823194379722556",
141 ];
142 - use rand::prng::IsaacRng;
143 + use rand_isaac::IsaacRng;
144 seeded_value_stability::<IsaacRng>(EXPECTED);
145 }
146
147 @@ -156,7 +159,7 @@ mod biguint {
148 "53041498719137109355568081064978196049094604705283682101683207799515709404788873\
149 53417136457745727045473194367732849819278740266658219147356315674940229288531",
150 ];
151 - use rand::prng::XorShiftRng;
152 + use rand_xorshift::XorShiftRng;
153 seeded_value_stability::<XorShiftRng>(EXPECTED);
154 }
155 }
156 @@ -280,7 +283,7 @@ mod bigint {
157 "501454570554170484799723603981439288209930393334472085317977614690773821680884844\
158 8530978478667288338327570972869032358120588620346111979053742269317702532328",
159 ];
160 - use rand::prng::ChaChaRng;
161 + use rand_chacha::ChaChaRng;
162 seeded_value_stability::<ChaChaRng>(EXPECTED);
163 }
164
165 @@ -299,7 +302,7 @@ mod bigint {
166 "-14563174552421101848999036239003801073335703811160945137332228646111920972691151\
167 88341090358094331641182310792892459091016794928947242043358702692294695845817",
168 ];
169 - use rand::prng::IsaacRng;
170 + use rand_isaac::IsaacRng;
171 seeded_value_stability::<IsaacRng>(EXPECTED);
172 }
173
174 @@ -318,7 +321,7 @@ mod bigint {
175 "49920038676141573457451407325930326489996232208489690499754573826911037849083623\
176 24546142615325187412887314466195222441945661833644117700809693098722026764846",
177 ];
178 - use rand::prng::XorShiftRng;
179 + use rand_xorshift::XorShiftRng;
180 seeded_value_stability::<XorShiftRng>(EXPECTED);
181 }
182 }
183 diff --git a/tests/torture.rs b/tests/torture.rs
184 index 4f073d3..025fdeb 100644
185 --- a/tests/torture.rs
186 +++ b/tests/torture.rs
187 @@ -6,6 +6,7 @@ extern crate rand;
188
189 use num_bigint::RandBigInt;
190 use num_traits::Zero;
191 +use rand::rngs::SmallRng;
192 use rand::prelude::*;
193
194 fn test_mul_divide_torture_count(count: usize) {
0 --- a/Cargo.toml
1 +++ b/Cargo.toml
2 @@ -50,7 +50,7 @@
3 default-features = false
4
5 [dependencies.quickcheck]
6 -version = "0.8"
7 +version = "0.9"
8 optional = true
9 default-features = false
10
11 @@ -60,8 +60,8 @@
12 default-features = false
13
14 [dependencies.rand]
15 -version = "0.5"
16 -features = ["std"]
17 +version = "0.7"
18 +features = ["std", "small_rng"]
19 optional = true
20 default-features = false
21
22 @@ -72,6 +72,16 @@
23 default-features = false
24 [dev-dependencies.serde_test]
25 version = "1.0"
26 +
27 +[dev-dependencies.rand_xorshift]
28 +version = "0.2.0"
29 +
30 +[dev-dependencies.rand_chacha]
31 +version = "0.2.0"
32 +
33 +[dev-dependencies.rand_isaac]
34 +version = "0.2.0"
35 +
36 [build-dependencies.autocfg]
37 version = "0.1.2"
38
0 relax-deps.patch
1 rand-0.7.patch