Codebase list rust-serde-xml-rs / 1504a2e
package randomize, that's needed as a build dependency for ripasso Alexander Kjäll 3 years ago
7 changed file(s) with 310 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
0 rust-randomize (3.0.1-1) UNRELEASED-FIXME-AUTOGENERATED-DEBCARGO; urgency=medium
1
2 * Package randomize 3.0.1 from crates.io using debcargo 2.4.2
3
4 -- Alexander Kjäll <alexander.kjall@gmail.com> Tue, 29 Sep 2020 18:56:07 +0200
0 Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
1 Upstream-Name: randomize
2 Upstream-Contact: Lokathor <zefria@gmail.com>
3 Source: https://github.com/Lokathor/randomize
4
5 Files: *
6 Copyright: 2018-2020 Lokathor <zefria@gmail.com>
7 License: 0BSD
8
9 Files: debian/*
10 Copyright:
11 2020 Debian Rust Maintainers <pkg-rust-maintainers@alioth-lists.debian.net>
12 2020 Alexander Kjäll <alexander.kjall@gmail.com>
13 License: 0BSD
14
15 License: 0BSD
16 Permission to use, copy, modify, and/or distribute this software for any purpose
17 with or without fee is hereby granted.
18 .
19 THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
20 REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
21 FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
22 INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
23 OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
24 TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
25 THIS SOFTWARE.
26
0 Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
1 Upstream-Name: randomize
2 Upstream-Contact: Lokathor <zefria@gmail.com>
3 Source: https://github.com/Lokathor/randomize
4
5 Files: *
6 Copyright: FIXME (overlay) UNKNOWN-YEARS Lokathor <zefria@gmail.com>
7 License: 0BSD
8 Comment:
9 FIXME (overlay): Since upstream copyright years are not available in
10 Cargo.toml, they were extracted from the upstream Git repository. This may not
11 be correct information so you should review and fix this before uploading to
12 the archive.
13
14 Files: ./LICENSE-0BSD.md
15 Copyright: 2019 Daniel Gee <zefria@gmail.com>
16 License: UNKNOWN-LICENSE; FIXME (overlay)
17 Comment:
18 FIXME (overlay): These notices are extracted from files. Please review them
19 before uploading to the archive.
20
21 Files: debian/*
22 Copyright:
23 2020 Debian Rust Maintainers <pkg-rust-maintainers@alioth-lists.debian.net>
24 2020 Alexander Kjäll <alexander.kjall@gmail.com>
25 License: 0BSD
26
27 License: 0BSD
28 FIXME (overlay): Unrecognized crate license, please find the full license text in the rest of the crate source code and copy-paste it here
0 overlay = "."
1 uploaders = ["Alexander Kjäll <alexander.kjall@gmail.com>"]
0 diff --git a/src/bin/randomize.rs b/src/bin/randomize.rs
1 deleted file mode 100644
2 index 868d6b8..0000000
3 --- a/src/bin/randomize.rs
4 +++ /dev/null
5 @@ -1,87 +0,0 @@
6 -#![allow(clippy::cast_lossless)]
7 -
8 -use randomize::*;
9 -use std::io::*;
10 -
11 -pub fn main() {
12 - match std::env::args()
13 - .nth(1)
14 - .expect("must specify a generator!")
15 - .as_ref()
16 - {
17 - "PCG32" => {
18 - let r = clock_u64();
19 - let mut gen = PCG32::from([r, r]);
20 - runner32(|| gen.next_u32())
21 - }
22 - "PCG64" => {
23 - let r = u128::from(clock_u64());
24 - let mut gen = PCG64::from([r, r]);
25 - runner64(|| gen.next_u64())
26 - }
27 - "LCG128-high32" => {
28 - let mut r = u128::from(clock_u64());
29 - runner32(|| {
30 - r = lcg128(r, PCG_MULTIPLIER_128, 1);
31 - (r >> 96) as u32
32 - })
33 - }
34 - "LCG128-high64" => {
35 - let mut r = u128::from(clock_u64());
36 - runner64(|| {
37 - r = lcg128(r, PCG_MULTIPLIER_128, 1);
38 - (r >> 64) as u64
39 - })
40 - }
41 - unknown => panic!("Unknown generator: {:?}", unknown),
42 - };
43 -}
44 -
45 -/// A `u64` based on the system clock.
46 -fn clock_u64() -> u64 {
47 - let now = std::time::SystemTime::now();
48 - match now.duration_since(std::time::SystemTime::UNIX_EPOCH) {
49 - Ok(dur) => dur.as_secs(),
50 - Err(ste) => ste.duration().as_secs(),
51 - }
52 -}
53 -
54 -fn runner32<F: FnMut() -> u32>(mut f: F) {
55 - // arbitrary selection of one cache line at a time
56 - const BYTE_BUFFER_LENGTH: usize = 64;
57 - const U32_COUNT: usize = BYTE_BUFFER_LENGTH / core::mem::size_of::<u32>();
58 -
59 - let mut buf: [u32; U32_COUNT] = [0; U32_COUNT];
60 - let stdout: Stdout = std::io::stdout();
61 - let mut lock: StdoutLock = stdout.lock();
62 - loop {
63 - for buf_mut in buf.iter_mut() {
64 - *buf_mut = f();
65 - }
66 - lock
67 - .write_all(unsafe {
68 - core::slice::from_raw_parts(buf.as_ptr() as *const u8, BYTE_BUFFER_LENGTH)
69 - })
70 - .expect("failed to write to stdout!");
71 - }
72 -}
73 -
74 -fn runner64<F: FnMut() -> u64>(mut f: F) {
75 - // arbitrary selection of one cache line at a time
76 - const BYTE_BUFFER_LENGTH: usize = 64;
77 - const U64_COUNT: usize = BYTE_BUFFER_LENGTH / core::mem::size_of::<u64>();
78 -
79 - let mut buf: [u64; U64_COUNT] = [0; U64_COUNT];
80 - let stdout: Stdout = std::io::stdout();
81 - let mut lock: StdoutLock = stdout.lock();
82 - loop {
83 - for buf_mut in buf.iter_mut() {
84 - *buf_mut = f();
85 - }
86 - lock
87 - .write_all(unsafe {
88 - core::slice::from_raw_parts(buf.as_ptr() as *const u8, BYTE_BUFFER_LENGTH)
89 - })
90 - .expect("failed to write to stdout!");
91 - }
92 -}
0 diff --git a/benches/bench_fill_bytes.rs b/benches/bench_fill_bytes.rs
1 deleted file mode 100644
2 index c8c2d7b..0000000
3 --- a/benches/bench_fill_bytes.rs
4 +++ /dev/null
5 @@ -1,56 +0,0 @@
6 -#![feature(test)]
7 -#![allow(bad_style)]
8 -
9 -extern crate test;
10 -use test::Bencher;
11 -
12 -use randomize::*;
13 -
14 -#[bench]
15 -fn bench_fill_bytes_PCG32(b: &mut Bencher) {
16 - let mut v = vec![0u8; 1_000_000];
17 - let mut gen = PCG32::seed(clock_u64(), 5);
18 - b.iter(|| {
19 - gen.fill_bytes(&mut v[..]);
20 - });
21 - println!("{}", v[0]);
22 -}
23 -
24 -#[bench]
25 -fn bench_fill_bytes_PCG64(b: &mut Bencher) {
26 - let mut v = vec![0u8; 1_000_000];
27 - let mut gen = PCG64::seed(u128::from(clock_u64()), 5);
28 - b.iter(|| {
29 - gen.fill_bytes(&mut v[..]);
30 - });
31 - println!("{}", v[0]);
32 -}
33 -
34 -#[bench]
35 -fn bench_fill_bytes_AnyPCG32(b: &mut Bencher) {
36 - let mut v = vec![0u8; 1_000_000];
37 - let mut gen = AnyPCG::new(PCG32::seed(clock_u64(), 5));
38 - b.iter(|| {
39 - gen.fill_bytes(&mut v[..]);
40 - });
41 - println!("{}", v[0]);
42 -}
43 -
44 -#[bench]
45 -fn bench_fill_bytes_AnyPCG64(b: &mut Bencher) {
46 - let mut v = vec![0u8; 1_000_000];
47 - let mut gen = AnyPCG::new(PCG64::seed(u128::from(clock_u64()), 5));
48 - b.iter(|| {
49 - gen.fill_bytes(&mut v[..]);
50 - });
51 - println!("{}", v[0]);
52 -}
53 -
54 -/// A `u64` based on the system clock.
55 -fn clock_u64() -> u64 {
56 - let now = std::time::SystemTime::now();
57 - match now.duration_since(std::time::SystemTime::UNIX_EPOCH) {
58 - Ok(dur) => dur.as_secs(),
59 - Err(ste) => ste.duration().as_secs(),
60 - }
61 -}
62 diff --git a/benches/bench_generators.rs b/benches/bench_generators.rs
63 deleted file mode 100644
64 index 3133c33..0000000
65 --- a/benches/bench_generators.rs
66 +++ /dev/null
67 @@ -1,84 +0,0 @@
68 -#![feature(test)]
69 -
70 -extern crate test;
71 -use test::Bencher;
72 -
73 -use randomize::{formulas::*, *};
74 -
75 -// Note(Lokathor): This is provided for comparison purposes with the PCGs. LCGs
76 -// smaller than 128 bit definitely won't pass any statistical tests, but an
77 -// LCG128 actually could pass if you keep only the high 64 from each state
78 -// change. There isn't an actual struct provided for this in the lib, because
79 -// the increased cost of a 128-bit multiply makes this perform only as fast as a
80 -// PCG32, even with the reduced output "permutation" complexity. I suppose if
81 -// you wanted 64-bit output with speed over quality you could use this, but I'm
82 -// not going to build that for you.
83 -#[bench]
84 -fn bench_lcg128_top32(b: &mut Bencher) {
85 - let mut state = u128::from(clock_u64());
86 - let mut x = 0u32;
87 - b.iter(|| {
88 - for _ in 0..1_000_000 {
89 - state = lcg128(state, PCG_MULTIPLIER_128, 1);
90 - x = (state >> 96) as u32;
91 - }
92 - });
93 - println!("{},{}", state, x);
94 -}
95 -
96 -#[bench]
97 -fn bench_pcg32(b: &mut Bencher) {
98 - let mut gen = PCG32::seed(clock_u64(), 5);
99 - let mut x = 0;
100 - b.iter(|| {
101 - for _ in 0..1_000_000 {
102 - x = gen.next_u32();
103 - }
104 - });
105 - println!("{:?} {}", gen, x);
106 -}
107 -
108 -#[bench]
109 -fn bench_pcg64(b: &mut Bencher) {
110 - let mut gen = PCG64::seed(u128::from(clock_u64()), 5);
111 - let mut x = 0;
112 - b.iter(|| {
113 - for _ in 0..1_000_000 {
114 - x = gen.next_u64();
115 - }
116 - });
117 - println!("{:?} {}", gen, x);
118 -}
119 -
120 -#[bench]
121 -fn bench_any32(b: &mut Bencher) {
122 - let mut gen = AnyPCG::new(PCG32::seed(clock_u64(), 5));
123 - let mut x = 0;
124 - b.iter(|| {
125 - for _ in 0..1_000_000 {
126 - x = gen.next_u32();
127 - }
128 - });
129 - println!("{:?} {}", gen, x);
130 -}
131 -
132 -#[bench]
133 -fn bench_any64(b: &mut Bencher) {
134 - let mut gen = AnyPCG::new(PCG64::seed(u128::from(clock_u64()), 5));
135 - let mut x = 0;
136 - b.iter(|| {
137 - for _ in 0..1_000_000 {
138 - x = gen.next_u64();
139 - }
140 - });
141 - println!("{:?} {}", gen, x);
142 -}
143 -
144 -/// A `u64` based on the system clock.
145 -fn clock_u64() -> u64 {
146 - let now = std::time::SystemTime::now();
147 - match now.duration_since(std::time::SystemTime::UNIX_EPOCH) {
148 - Ok(dur) => dur.as_secs(),
149 - Err(ste) => ste.duration().as_secs(),
150 - }
151 -}
0 randomize-remove-nightly-tests.patch
1 randomize-remove-binary-from-library.patch