Tuesday, March 27, 2007

The path of Underworld FC

Saturday 24 March was the last day of sport week and so was the final phase of the seven-side football tournament. Earlier during the week, on Wednesday we emerged victorious in the qualifying round by beating every team that had the misfortune to play against us. It was a long and tiresome Wednesday but in the end we were the last one remaining on the field.

Saturday, the day of the final phase, we also played very well in our pool, we again beat every team in our pool to reach the final. However, at the end due to lack of sport spirit of some teams, we had to play our last three matches without getting time to rest in between since some teams already gone. Our opponent in the final were much much fresher than we were and eventually that played against us which result in a loss. We all know that on any normal day we could well beat that team. The good thing is that both teams are qualified for the intertertiary tournament that is coming soon. We hope to meet them again to really know whether they were really good to beat us. Anyways, that ay was really fun, we really enjoyed ourselves. Below are some pictures after the tournament..

There we were waiting for our medal..


We and our medal...


Proudly lifting up the cup for the faculty of Engineering..






Monday, March 19, 2007

Random number revisited(without using the rand() function)

Like I mention earlier,nothing is random in a computer.Only the nature is random,hence considering which "things" of nature do we have in the computer,in my opinion it is time.Well some may say that time is not a "random thing" because we know what time is it now,some hours later and so on.But my point in this case is that we need to have a random number and suppose that we keep track of the number of seconds that have elapsed after a specific time and each time we need a random number, then we can consider the number of seconds that have elapsed after the specific time we stated.The number that we would get would be different each time(of course that could be calculated if we are keeping track at the time we want the random number.The previous algorithm I've posted is modified a bit(just replacing the ran() function).See below the blue part is the added one and the green one is the one that is being removed from the previous version.

int generate_unique_random(){
static int b=0,a=20,myarray[20];
int index,temp,y;

time_t seconds;

if(b==0){
for(y=0;y<20;y++)
myarray[y]=y+1;}

//srand(time(NULL));
//index=rand()%a+b;


seconds = time (NULL);
index=(seconds)%a+b;


temp = myarray[index];
myarray[index]=myarray[b];
myarray[b]=temp;

b++;
a--;
return temp;
}






Sunday, March 18, 2007

Bonus mark for writing an algorithm which generate unique random numbers

I've got a bonus mark for making my code to run on complexity O(1)...thats was really cool.
The question was as follow:

Write a function in C which returns a random integer between 1 and 20. One
extremely important caracteristic of the function is that it must return a different
integer each time it is called. This, obviously, implies that it can only be
called twenty times.
Use this signature:
int generate_unique_random()
{
/* to be completed */
}


The most important part(in my opinion,of course) in it was to ensure that each time a
unique number be returned when the function is to be called.Check out my code below:

#include
#include
#include

One important thing that should be noted here is the fact that randomness is something very unnatural to do.Nothing is random in the computer,the only thing that is random is nature.However to generate random number in the above case,the use of the function rand() is made.I'm trying to enhance my code without making use of the rand() funtion but still using the same algoritmn...will post it as soon as  possible.













Saturday, March 17, 2007

Jalsa DJ battle at the uni

The party was tooooo short.Just as we started having fun,the jalsa was already over.At the end we cannot possibly said that its was a jalsa.

Thursday, March 15, 2007

My first blog

Finally, I've decided to do it.For some time was wondering to create
a blog or not.Today I've just did it and hope that this will work great.
Share your opinions here