Hello,
I get the following errors for the “pseudo_rand_seq” function.
I need to pass a const to the function so that I can create an array with it. I am coming from a C background. How do I do this in Rust? Thanks
error: expected pattern, found keyword `const`
> src\ts_36211.rs:119:20

119  fn pseudo_rand_seq(const n_bits: u32, cinit: u32) > u32 {
 ^^^^^ expected pattern
error[E0425]: cannot find value `n_bits` in this scope
> src\ts_36211.rs:128:32

128  let c: [u32; n_bits] = [0; n_bits];
 ^^^^^^ not found in this scope
// Pseudo random sequences
// TS 36.211 V12.2.0, section 7.2
// Pseudorandom sequences are defined by _a length31 Gold sequence
fn pseudo_rand_seq(const n_bits: u32, cinit: u32) > u32 {
//let i: u32 = 0;
let mut x1: u32 = 0;
let mut n1: u32 = 0;
let mut x2: u32 = 0;
let mut n2: u32 = 0;
x1 = x_1();
x2 = x_2(cinit);
let c: [u32; n_bits] = [0; n_bits];
for i in 0..n_bits {
n1 = ((x1 >> 3) ^ x1) & 0x1;
n2 = ((x2 >> 3)^(x2 >> 2)^(x2 >> 1)^x2) & 0x1;
x1 = (x1 >> 1)  (n1 << 30);
x2 = (x2 >> 1)  (n2 << 30);
c[i] = n1 ^ n2;
}
c
}