Commit 45a8c9c2 by Sergey.Kolodchenko

Upload New File

parent 315f4c12
Showing with 41 additions and 0 deletions
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <time.h>
int main () {
char buffer [64]= {0};
int i;
int my_seed;
int x;
int y;
int z;
printf("Enter name: \n");
scanf("%s".bufferl);
print("\nYour name is %s\n".bufferl);
printf("Length of the words are %u characters.\n", strlen(bufferl));
for (i=0; i<strlen(bufferl); i++) {
my_seed=my_seed + buffer[i]*pow(10,i);
}
my_seed=my_seed^0xDEADBABE;
printf("%d\n".my_seed);
//printf ("First number: %d\n", rand() %100);
srand(my_seed);
printf("\nRandom nmber; %d\n", rand()%100);
srand (1);
x = rand() % 1;
if (x==1) {
y= rand() % 5;
} else {
y= rand() % 2;
}
z= rand() % 3;
printf("\nIndex slot is [%d] [%d] [%d]",x,y,z);
return 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment