Archive for February, 2007|Monthly archive page
Boi Mela
Every year in February month, bangladesh er bangla academy te ekushe boi mela hoy. Onek onek boi pawa jay. Sara bosor dhoira writer ra lekhe r boi mela te prokash kore. Onek onek vir hoy. Onek onek boi kena becha hoy. Pray shobai boi melay jay. Even picchi polapain beshi jay . 😀 .. Amio jai, eibar jawa hoy nai . Boi melar link ta na dile kemon hoy, tai banglaacademy er address
How to Generate a Good Random Number in C++
In c++ u can generate random numbers by calling rand() function which is built in stdlib.h . But if u use this function without setting any seed then it gives the same random value whenever u run the code again. To solve this u can give a seed to generate random number. The best seed can be the time. A seed is set up by srand(somevalue) function. So use time u have to include time.h. Now u initialize the seed in main and use rand() fucntions else where. Now u will get different random value in different time.
A sample code can be
#include
#include
#include
#include
void printSomeRand()
{
for(int i=0;i<10;i++)
{
printf(“%d \n”,rand());///use rand to generate a random number
}
}
void main()
{
srand((unsigned) time(NULL)); ///give a seed, dont give seed whenever u call rand
printSomeRand();
}
Hello world!
Hello world !!!
The most amazing word in this programming world. There is no such programmer who ever didnt wrote the hello world 😀
We like this word, we love this world
When ever we first write a program, we start with hello world!!