diff options
Diffstat (limited to 'divesite.c')
-rw-r--r-- | divesite.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/divesite.c b/divesite.c index 4f236017f..f7f6afea1 100644 --- a/divesite.c +++ b/divesite.c @@ -39,8 +39,12 @@ static uint32_t dive_site_getUniqId() { uint32_t id = 0; - while (id == 0 || get_dive_site_by_uuid(id)) - id = random() + random(); + while (id == 0 || get_dive_site_by_uuid(id)) { + id = rand() & 0xff; + id |= (rand() & 0xff) << 8; + id |= (rand() & 0xff) << 16; + id |= (rand() & 0xff) << 24; + } return id; } |