rand() by default does increment of 1, randomizing more

Random number generation in case of IAR 8, requires TLS support.
Thread local storage is not part of Mbed OS, test is updated to have random
numbers sparse, but in future random number creation should be moved to main
thread, or use some other logic for randomization instead of rand() call.
pull/9818/head
Deepika 2019-02-22 16:19:23 -06:00
parent 270827b0d5
commit f7a6d254f6
2 changed files with 6 additions and 4 deletions

View File

@ -49,8 +49,9 @@ void basic_erase_program_read_test(SPIFBlockDevice &block_device, bd_size_t bloc
_mutex->lock(); _mutex->lock();
// Make sure block address per each test is unique // Make sure block address per each test is unique
static unsigned block_seed = 1; static unsigned block_seed = SPIF_TEST_NUM_OF_THREADS;
srand(block_seed++); srand(block_seed);
block_seed += 2;
// Find a random block // Find a random block
bd_addr_t block = (rand() * block_size) % block_device.size(); bd_addr_t block = (rand() * block_size) % block_device.size();

View File

@ -189,8 +189,9 @@ void basic_erase_program_read_test(BlockDevice *block_device, bd_size_t block_si
_mutex->lock(); _mutex->lock();
// Make sure block address per each test is unique // Make sure block address per each test is unique
static unsigned block_seed = 1; static unsigned block_seed = TEST_NUM_OF_THREADS;
srand(block_seed++); srand(block_seed);
block_seed += 2;
// Find a random block // Find a random block
bd_addr_t block = (rand() * block_size) % (block_device->size()); bd_addr_t block = (rand() * block_size) % (block_device->size());