static error test_random(atom_set_t *d) { error err; int i; printf("test: random\n"); for (i = 0; i < 100; i++) { const char *name; atom_t idx; name = randomname(); printf("adding '%s'... ", name); err = atom_new(d, (const unsigned char *) name, strlen(name) + 1, &idx); if (err && err != error_ATOM_NAME_EXISTS) return err; if (err == error_ATOM_NAME_EXISTS) printf("already exists "); printf("as %d\n", idx); } return error_OK; }
struct character_info random_character() { struct character_info number_one; number_one.health = 100; number_one.color = number_one.locationX = 22; number_one.locationY = 5; strcpy(number_one.name, randomname()); return number_one; }