
ある夜、無性にサラダが食べたくなってそこらへんにあった小松菜と胡瓜を生で切り刻んで食べたのだが、、、小松菜の後味が微妙に苦くてよろしくなかった。
ちょろっと調べてみたら炒め物やおひたしで利用するのが通常らしく、生で食うもんじゃないらしい(´ー`; )
#include <stdio.h> | |
int main(int argc, char *argv[]) | |
{ | |
int a = 0; | |
// displays true! | |
if (a == 0) printf("true!\n"); | |
else { | |
printf("false!\n"); | |
} | |
return 0; | |
} |
#include <math.h> | |
#include <time.h> | |
#include <stdlib.h> | |
#include <stdio.h> | |
#include <errno.h> | |
// | |
// returns random number from zero to max. | |
// to compile this, run the following command. | |
// $ gcc -Wall -lm -lrt filename | |
// | |
double getRand(struct drand48_data *data, int max) | |
{ | |
double rand = 0; | |
drand48_r(data, &rand); | |
rand = floor(rand * max); | |
return rand; | |
} | |
int initRand(struct drand48_data *data) | |
{ | |
struct timespec time; | |
int result = clock_gettime(CLOCK_REALTIME, &time); | |
if (result == -1) { | |
perror("clock_gettime"); | |
return -1; | |
} | |
srand48_r(time.tv_nsec, data); | |
return 0; | |
} | |
int main(int argc, char *argv[]) | |
{ | |
int c, result; | |
struct drand48_data data; | |
result = initRand(&data); | |
if (result == -1) { | |
return result; | |
} | |
for (c = 0; c < 100; c++) { | |
printf("%.0f\n", getRand(&data, 500)); | |
} | |
return 0; | |
} |