Independence

Written on Tuesday, March 13, 2007 by Unknown

Been a while that i didnt blog..

Been real busy lately. Where to start?? Well many things happened lately.. Am done with 2 tests..and got another one for tom..need to go revise..
In the past week there was also the Mega Show of the Rays Club, in which i was participating. The rehearsals we re tiring and here is a glimpse of the item we performed. I couldn't manage to get the whole video, the memory card was already full and my bro had to film this with the 32mb memory card. This was filmed in low resolution :s



Will b writing more later..need to go revise..and ya happy independence day (this post was due for yesterday..forgot to post :s:s)..


powered by performancing firefox

Random...

Written on Monday, March 05, 2007 by Unknown

There was an assignment (or rather programming quiz) given for the System Software lecture..this is the first part of the program. Eventually this program works..bt is not efficient enough, need to refine it..



Am not a too great C programmer..(i would rather be a Java guy..) had to do some search over google to know how to generate random numbers..



here goes the code..



#include <stdio.h>

#include <stdlib.h>

#include <time.h>



const int min = 1;

const int max = 20;



int generate_unique_random();



int main()

{

     int ran;

     int j=1;

     while(j<21)

     {

        ran=generate_unique_random();

        printf("Number %d is %d,\n",j,ran);

        j++;

     }

}



int generate_unique_random()

{

     static int arr[21];

     time_t seconds;

     time(&seconds);

     srand((unsigned int) seconds);

     int number;

     while(1)

     {

        number = rand() % (max - min + 1) + min;

        if (arr[number]!=1)

        {

           arr[number]=1;

           return number;

        }

     }

}




powered by performancing firefox