random_linear_code/
random_linear_code.rs1use ldpc::codes::LinearCode;
2use ldpc::noise::{BinarySymmetricChannel, Probability};
3use rand::thread_rng;
4
5fn main() {
6 let code = LinearCode::random_regular_code()
7 .num_bits(4)
8 .num_checks(3)
9 .bit_degree(3)
10 .check_degree(4)
11 .sample_with(&mut thread_rng())
12 .unwrap();
13
14 let noise = BinarySymmetricChannel::with_probability(Probability::new(0.2));
15 let error = code.random_error(&noise, &mut thread_rng());
16 println!("{}", error);
17}