void GameBoard::init(CellStatus s, bool genseed) { cells_.clear(); qDeleteAll(ships_); ships_.clear(); for (int i = 0; i < 100; ++i) { cells_.append(GameCell(s)); if (genseed) cells_[i].seed = genSeed(32); } ships_.append(new GameShip(5, QString(), this)); ships_.append(new GameShip(4, QString(), this)); ships_.append(new GameShip(3, QString(), this)); ships_.append(new GameShip(2, QString(), this)); ships_.append(new GameShip(2, QString(), this)); ships_.append(new GameShip(1, QString(), this)); ships_.append(new GameShip(1, QString(), this)); }
int main(int argc, char** argv){ int i; genSeed(); // Generate the seed printf("Begin Simluation\n"); printf("Num of particles: %d\n", PARTICLES); printf("Sizeof struct : %d\n", sizeof(part)); printf("Room Sizes: \n"); printf(" ::Max x %d\n", MAXX); printf(" ::Max y %d\n", MAXY); printf(" ::Max z %d\n", MAXZ); printf(" ::Min x %d\n", MINX); printf(" ::Min y %d\n", MINY); printf(" ::Min z %d\n", MINZ); // Random Generation printf("Gene"); for(i=0; i<PARTICLES; ++i){ part[i].x = rand()%MAXX; part[i].y = rand()%MAXY; part[i].z = rand()%MAXZ; part[i].group = rand()%GROUP; ++stats_groups_before[part[i].group]; // count the groups } printf("rated!\n"); glutInit(&argc, argv); glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB); glutInitWindowSize(400, 400); glutInitWindowPosition(40, 40); glutCreateWindow("Particlez"); setup(); glutDisplayFunc(render); //glutTimerFunc(33, timer, 1); glutMainLoop(); return 0; }
int main(int argc, char *argv[]) { iftImage* orig; timer *t1 = NULL, *t2 = NULL; char outfile[100]; iftDir* inputDir = iftLoadFilesFromDirectory(argv[1], "pgm"); int i; for (i = 0; i < inputDir->nfiles; ++i) { orig = iftReadImageByExt(inputDir->files[i]->pathname); genSeed(iftBasename(inputDir->files[i]->pathname), orig); } return 0; }
inline RGen::RGen() : _rng(genSeed()) {}