Random Seed utilities

git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@539 127b21dd-08f5-0310-b4b7-95ae10353056
This commit is contained in:
Giles Williams 2006-05-10 12:08:55 +00:00
parent 4ef23ada7c
commit 4bfd113941
2 changed files with 17 additions and 0 deletions

View File

@ -203,6 +203,20 @@ void make_pseudo_random_seed (struct rand_seed_6uc *seed_ptr)
seed_ptr->f = gen_rnd_number();
}
Random_Seed nil_seed()
{
Random_Seed result = { (unsigned char)0, (unsigned char)0, (unsigned char)0, (unsigned char)0, (unsigned char)0, (unsigned char)0};
return result;
}
int is_nil_seed(Random_Seed a_seed)
{
if (a_seed.a | a_seed.b | a_seed.c | a_seed.d | a_seed.e | a_seed.f)
return -1;
else
return 0;
}
void rotate_seed (struct rand_seed_6uc *seed_ptr)
{
unsigned int x;

View File

@ -90,6 +90,9 @@ int gen_rnd_number (void);
void make_pseudo_random_seed (struct rand_seed_6uc *seed_ptr);
Random_Seed nil_seed();
int is_nil_seed(Random_Seed a_seed);
void rotate_seed (struct rand_seed_6uc *seed_ptr);
int rotate_byte_left (int x);