[ create a new paste ] login | about

Link: http://codepad.org/9ak7ZCQJ    [ raw code | output | fork ]

C, pasted on Apr 16:
#include <unistd.h>
#include <stdlib.h>

#define maksymalny_random 100
#define  minimalny_random 0

int a;
int b[101];

int main()
{
 int c;
 srand(time(NULL));
 for ( c=0;c<100000;c++ )
 {
    a = (double)rand() / (((double)RAND_MAX + 1) / (maksymalny_random-minimalny_random)) + minimalny_random;
    b[a]++;
 }
 int min=100000;
 int max=0;
 int wypisac;
 for ( c=0;c<100;c++ )
 {
    wypisac = b[c]/50;
    while (wypisac){
        printf("#");
        wypisac--;
    }
    printf("\n");
    if(b[c] < min)
        min = b[c];

    if(b[c] > max)
        max = b[c];
 }
 printf("min:%d max%d\n",min,max);
 return 0;
}


Output:
####################
####################
###################
####################
#####################
###################
####################
###################
####################
###################
####################
###################
###################
####################
####################
###################
###################
##################
####################
###################
####################
####################
#####################
###################
###################
####################
###################
###################
##################
###################
###################
####################
####################
###################
####################
###################
####################
#####################
###################
####################
###################
####################
####################
####################
##################
#####################
###################
###################
###################
##################
####################
####################
###################
###################
###################
####################
####################
####################
####################
####################
####################
###################
####################
###################
###################
###################
####################
###################
####################
####################
###################
###################
####################
####################
####################
###################
###################
###################
####################
####################
###################
###################
###################
###################
####################
###################
###################
###################
####################
####################
####################
####################
##################
####################
####################
####################
###################
###################
####################
####################
min:920 max1073


Create a new paste based on this one


Comments: