Last active
June 4, 2023 07:16
-
-
Save LiosK/ea424481fb84df162a0afaabe042eedb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::{fs, io::Write as _, process}; | |
fn main() { | |
let _ = rand::random::<u32>(); // initialize ThreadRng | |
let parent_pid = process::id(); | |
unsafe { nix::unistd::fork() }.expect("fork failed"); | |
let filename = format!("out_{}_{}.txt", parent_pid, process::id()); | |
let mut f = fs::File::create(filename).expect("could not create file"); | |
for i in 0..64 { | |
writeln!(f, "{:02}\t{}", i, rand::random::<u32>()).expect("could not write to file"); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- out_13884_13884.txt 2023-06-04 16:15:51 | |
+++ out_13884_13946.txt 2023-06-04 16:15:51 | |
@@ -61,4 +61,4 @@ | |
60 65424673 | |
61 3794020000 | |
62 3067067439 | |
-63 365650879 | |
+63 4036659996 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This file is automatically @generated by Cargo. | |
# It is not intended for manual editing. | |
version = 3 | |
[[package]] | |
name = "autocfg" | |
version = "1.1.0" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" | |
[[package]] | |
name = "bitflags" | |
version = "1.3.2" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" | |
[[package]] | |
name = "cfg-if" | |
version = "1.0.0" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" | |
[[package]] | |
name = "getrandom" | |
version = "0.2.9" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
checksum = "c85e1d9ab2eadba7e5040d4e09cbd6d072b76a557ad64e797c2cb9d4da21d7e4" | |
dependencies = [ | |
"cfg-if", | |
"libc", | |
"wasi", | |
] | |
[[package]] | |
name = "libc" | |
version = "0.2.144" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
checksum = "2b00cc1c228a6782d0f076e7b232802e0c5689d41bb5df366f2a6b6621cfdfe1" | |
[[package]] | |
name = "memoffset" | |
version = "0.7.1" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
checksum = "5de893c32cde5f383baa4c04c5d6dbdd735cfd4a794b0debdb2bb1b421da5ff4" | |
dependencies = [ | |
"autocfg", | |
] | |
[[package]] | |
name = "nix" | |
version = "0.26.2" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
checksum = "bfdda3d196821d6af13126e40375cdf7da646a96114af134d5f417a9a1dc8e1a" | |
dependencies = [ | |
"bitflags", | |
"cfg-if", | |
"libc", | |
"memoffset", | |
"pin-utils", | |
"static_assertions", | |
] | |
[[package]] | |
name = "pin-utils" | |
version = "0.1.0" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" | |
[[package]] | |
name = "ppv-lite86" | |
version = "0.2.17" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" | |
[[package]] | |
name = "rand" | |
version = "0.8.5" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" | |
dependencies = [ | |
"libc", | |
"rand_chacha", | |
"rand_core", | |
] | |
[[package]] | |
name = "rand_chacha" | |
version = "0.3.1" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" | |
dependencies = [ | |
"ppv-lite86", | |
"rand_core", | |
] | |
[[package]] | |
name = "rand_core" | |
version = "0.6.4" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" | |
dependencies = [ | |
"getrandom", | |
] | |
[[package]] | |
name = "reseed-threadrng" | |
version = "0.1.0" | |
dependencies = [ | |
"nix", | |
"rand", | |
] | |
[[package]] | |
name = "static_assertions" | |
version = "1.1.0" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" | |
[[package]] | |
name = "wasi" | |
version = "0.11.0+wasi-snapshot-preview1" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[package] | |
name = "reseed-threadrng" | |
version = "0.1.0" | |
edition = "2021" | |
publish = false | |
[[bin]] | |
name = "reseed-threadrng" | |
path = "0-reseed-threadrng.rs" | |
[dependencies] | |
nix = "0.26.2" | |
rand = "0.8.5" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
00 3783982018 | |
01 406526761 | |
02 599798609 | |
03 1091621824 | |
04 1431575904 | |
05 3326531692 | |
06 4278924660 | |
07 470142879 | |
08 3162189689 | |
09 3179586422 | |
10 3516564427 | |
11 2889759026 | |
12 3311226325 | |
13 3520988473 | |
14 2849876049 | |
15 1075328657 | |
16 3631730141 | |
17 1297097035 | |
18 1374881589 | |
19 1587001849 | |
20 3444933143 | |
21 3436433103 | |
22 3060571778 | |
23 3705951655 | |
24 3856879908 | |
25 1850727388 | |
26 187177798 | |
27 3134255198 | |
28 3416840891 | |
29 2261848360 | |
30 3783721500 | |
31 2974613995 | |
32 2241838541 | |
33 91993926 | |
34 3176613095 | |
35 4167452852 | |
36 3278357998 | |
37 4031526536 | |
38 131316144 | |
39 1233587167 | |
40 1553738062 | |
41 1964748964 | |
42 2842550088 | |
43 2753937673 | |
44 1138693857 | |
45 1808157734 | |
46 377645356 | |
47 1506702466 | |
48 1665128001 | |
49 802996963 | |
50 15511611 | |
51 3115644975 | |
52 2980790457 | |
53 923387948 | |
54 1143702588 | |
55 3897732763 | |
56 455464985 | |
57 3626947410 | |
58 418463823 | |
59 2844909589 | |
60 65424673 | |
61 3794020000 | |
62 3067067439 | |
63 365650879 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
00 3783982018 | |
01 406526761 | |
02 599798609 | |
03 1091621824 | |
04 1431575904 | |
05 3326531692 | |
06 4278924660 | |
07 470142879 | |
08 3162189689 | |
09 3179586422 | |
10 3516564427 | |
11 2889759026 | |
12 3311226325 | |
13 3520988473 | |
14 2849876049 | |
15 1075328657 | |
16 3631730141 | |
17 1297097035 | |
18 1374881589 | |
19 1587001849 | |
20 3444933143 | |
21 3436433103 | |
22 3060571778 | |
23 3705951655 | |
24 3856879908 | |
25 1850727388 | |
26 187177798 | |
27 3134255198 | |
28 3416840891 | |
29 2261848360 | |
30 3783721500 | |
31 2974613995 | |
32 2241838541 | |
33 91993926 | |
34 3176613095 | |
35 4167452852 | |
36 3278357998 | |
37 4031526536 | |
38 131316144 | |
39 1233587167 | |
40 1553738062 | |
41 1964748964 | |
42 2842550088 | |
43 2753937673 | |
44 1138693857 | |
45 1808157734 | |
46 377645356 | |
47 1506702466 | |
48 1665128001 | |
49 802996963 | |
50 15511611 | |
51 3115644975 | |
52 2980790457 | |
53 923387948 | |
54 1143702588 | |
55 3897732763 | |
56 455464985 | |
57 3626947410 | |
58 418463823 | |
59 2844909589 | |
60 65424673 | |
61 3794020000 | |
62 3067067439 | |
63 4036659996 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment