root/misc/neve.c

Revision 966, 0.8 kB (checked in by alpt, 2 years ago)

Initial revision

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1 /* Sun Jan 30 21:42:54 CET 2005
2  * by AlpT
3  * Un regalo per crash da un'idea di crash :***/
4
5 #include <stdlib.h>
6 #include <stdio.h>
7 #include <time.h>
8 #include <sys/types.h>
9 #include <unistd.h>
10
11
12 char S[9]="*.,'+ `:;";
13
14 inline int rand_range(int _min, int _max)
15 {
16         return (rand()%(_max - _min + 1)) + _min;
17 }
18 int surandom(char *file)
19 {
20         FILE *fd;
21         int seed;
22
23         fd=fopen("/dev/urandom", "r");
24         fread(&seed, 4,1,fd);
25         fclose(fd);
26         srand(seed);
27         return seed;
28 }
29
30 int surandom2(void)
31 {
32         srand(getpid()+time(0));
33 }
34
35 int main()
36 {
37         int i, x, e, o, buh;
38
39         /*surandom("/dev/urandom");*/
40         surandom2();
41
42         buh=rand_range(10,100);
43         for(o=0; o<buh; o++) {
44                 x=rand_range(1,30);
45                 e=0;
46                 for(i=0; i<=80; i++) {
47                         if(rand_range(0, 10) < 4 && e<x) {
48                                 printf("%c", S[rand_range(0,9)]);
49                                 e++;
50                         } else
51                                 printf(" ");
52                 }
53                 printf("\n");
54         }
55 }
Note: See TracBrowser for help on using the browser.