mirror of
https://github.com/aicodix/code.git
synced 2026-04-27 22:35:44 +00:00
added typedef to shorten the random generator lines
This commit is contained in:
parent
ab44dc4042
commit
903bf07584
3 changed files with 22 additions and 18 deletions
|
|
@ -28,8 +28,8 @@ int main()
|
|||
uint8_t code[L];
|
||||
for (int i = 0; i < L; ++i)
|
||||
code[i] = target[i];
|
||||
std::uniform_int_distribution<int> distribution(0, BCH::N-1);
|
||||
auto noise = std::bind(distribution, generator);
|
||||
typedef std::uniform_int_distribution<BCH::value_type> distribution;
|
||||
auto noise = std::bind(distribution(0, BCH::N-1), generator);
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
int n = noise();
|
||||
if (n < BCH::K)
|
||||
|
|
@ -61,8 +61,8 @@ int main()
|
|||
uint8_t *code = new uint8_t[L];
|
||||
for (int i = 0; i < L; ++i)
|
||||
code[i] = target[i];
|
||||
std::uniform_int_distribution<int> distribution(0, BCH::N-1);
|
||||
auto noise = std::bind(distribution, generator);
|
||||
typedef std::uniform_int_distribution<BCH::value_type> distribution;
|
||||
auto noise = std::bind(distribution(0, BCH::N-1), generator);
|
||||
for (int i = 0; i < 12; ++i) {
|
||||
int n = noise();
|
||||
if (n < BCH::K)
|
||||
|
|
@ -88,8 +88,8 @@ int main()
|
|||
BCH::value_type code[BCH::N];
|
||||
for (int i = 0; i < BCH::N; ++i)
|
||||
code[i] = target[i];
|
||||
std::uniform_int_distribution<BCH::value_type> distribution(0, BCH::N-1);
|
||||
auto noise = std::bind(distribution, generator);
|
||||
typedef std::uniform_int_distribution<BCH::value_type> distribution;
|
||||
auto noise = std::bind(distribution(0, BCH::N-1), generator);
|
||||
for (int i = 0; i < 3; ++i)
|
||||
code[noise()] ^= 1;
|
||||
decode(reinterpret_cast<GF::ValueType *>(code), reinterpret_cast<GF::ValueType *>(code) + BCH::K);
|
||||
|
|
@ -111,8 +111,8 @@ int main()
|
|||
BCH::value_type *code = new BCH::value_type[BCH::N];
|
||||
for (int i = 0; i < BCH::N; ++i)
|
||||
code[i] = target[i];
|
||||
std::uniform_int_distribution<BCH::value_type> distribution(0, BCH::N-1);
|
||||
auto noise = std::bind(distribution, generator);
|
||||
typedef std::uniform_int_distribution<BCH::value_type> distribution;
|
||||
auto noise = std::bind(distribution(0, BCH::N-1), generator);
|
||||
for (int i = 0; i < 12; ++i)
|
||||
code[noise()] ^= 1;
|
||||
(*decode)(reinterpret_cast<GF::ValueType *>(code), reinterpret_cast<GF::ValueType *>(code) + BCH::K);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue