Skip to content

Commit

Permalink
srand/rand uses unsigned ints
Browse files Browse the repository at this point in the history
  • Loading branch information
matpow2 committed Nov 26, 2018
1 parent 585d95a commit e70fcdb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 33 deletions.
31 changes: 0 additions & 31 deletions terraingen/tgen2/src/crossrand.h

This file was deleted.

7 changes: 5 additions & 2 deletions terraingen/tgen2/src/import/base.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,16 +112,19 @@ void DeleteCriticalSection_imp(uint32_t critical_section)
#endif
}

static thread_local unsigned int hold_rand = 1;

// import: rand
uint32_t rand_imp()
{
return cross_rand();
hold_rand = hold_rand * 214013 + 2531011;
return (hold_rand >> 16) & 0x7FFF;
}

// import: srand
void srand_imp(uint32_t value)
{
cross_srand(value);
hold_rand = (unsigned int)seed;
}

// import: IsProcessorFeaturePresent
Expand Down

0 comments on commit e70fcdb

Please sign in to comment.