int getrandom(void *rand, size_t size);
#include "myrand.h" int main() { char ran[32] = {0x00,}; int i; getrandom(ran, 32); for(i = 0; i < 32; i++) { printf("%c\n", ran[i]); } }
# ./myrand | mimencode WQpsCtgKLAqYCsQKpgprChsKTwrHCjcKkgorCp4KQwqvCogKCgo6CtUKQgohCngKZQrNCtAK DAqrClIKRwp3Cg==
#include <sys/time.h> #include <sys/types.h> #include <unistd.h> #include <string.h> #include <stdio.h> #include <string.h> int getrandom(void *rand, size_t size) { struct timeval tp; int i = 0; int ran; gettimeofday(&tp, NULL); srandom(tp.tv_sec | tp.tv_usec); while(1) { if (!(size / (4*(i+1)))) break; ran = random(); memcpy(rand+(i*4), (void *)&ran, 4); i++; } }
Copyrights © - Joinc, All Rights Reserved. Inherited From - Yundream Rebranded By - Joonphil
설명
사용방법
코드
참고 문헌
변경사항
Recent Posts
Archive Posts
Tags