Merge pull request 'fix typos' (#1) from brnsystems-patch-1 into master
All checks were successful
continuous-integration/drone/push Build is passing

Reviewed-on: https://brn.systems:3000/BRNSystems/RandMus/pulls/1
This commit is contained in:
Bruno Rybársky 2022-04-18 13:42:34 +02:00
commit 7097e54781

@ -1,21 +1,27 @@
#include <stdio.h> // putchar #include <stdio.h> // putchar
#include <stdlib.h> // rand #include <stdlib.h> // random generator
#include <time.h> // time #include <time.h> // time
const int num_samples = 6; const int num_samples = 6;
int main() { int main() {
srand(time(NULL)); // seed random number generator
int a[num_samples]; // array of random numbers int a[num_samples]; // array of random numbers
int i; // loop counter int i; // loop counter
int c; // out character int c; // out character
int tmp; // temp character int tmp; // temp character
int x; // loop counter int x; // loop counter
int y; // loop counter int y; // loop counter
srand(time(NULL)); // seed random number generator
while (1){ while (1){
for (x = 0; x < num_samples; x++) { for (x = 0; x < num_samples; x++) {
a[x] = rand() % 20 + 1; // set a[x] to a random number between 1 and 50 a[x] = rand() % 20 + 1; // set a[x] to a random number between 1 and 50
} }
for (i = 0;i<16000; i++) { // loop forever
for (i = 0;i<16000; i++) {
c = i >> a[0]; // shift right i by a[0] c = i >> a[0]; // shift right i by a[0]
c = c | i >> a[1]; // or c by i shifted right by a[1] c = c | i >> a[1]; // or c by i shifted right by a[1]
c = c * i; // multiply c by i c = c * i; // multiply c by i
@ -26,5 +32,7 @@ int main() {
c = c ^ tmp; // xor c by tmp c = c ^ tmp; // xor c by tmp
putchar(c); // print c putchar(c); // print c
} }
} }
} }