Remove deprecated macro (ipconfigRAND32) references (#781)

* Remove ipconfigRAND32 referances from demos

* Fix license header
This commit is contained in:
Aniruddha Kanhere 2022-01-31 11:18:55 -08:00 committed by GitHub
parent 4629138a42
commit 07c7ba7aa9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 136 additions and 47 deletions

View file

@ -318,12 +318,14 @@ missing data. */
BaseType_t lCharactersToAdd, lCharacter;
char cChar = '0';
const BaseType_t lMinimumLength = 60;
uint32_t ulRandomNumber;
/* Randomise the number of characters that will be sent in the echo
request. */
do
{
lCharactersToAdd = ipconfigRAND32() % ( ulBufferLength - 20UL );
( void ) xApplicationGetRandomNumber( &ulRandomNumber );
lCharactersToAdd = ulRandomNumber % ( ulBufferLength - 20UL );
} while( ( lCharactersToAdd == 0 ) || ( lCharactersToAdd < lMinimumLength ) ); /* Must be at least enough to add the unique text to the start of the string later. */
/* Fill the buffer. */

View file

@ -257,16 +257,22 @@ static void prvSRand( UBaseType_t ulSeed )
static void prvMiscInitialisation( void )
{
time_t xTimeNow;
uint32_t ulRandomNumbers[ 4 ];
/* Seed the random number generator. */
time( &xTimeNow );
FreeRTOS_debug_printf( ( "Seed for randomiser: %lu\n", xTimeNow ) );
prvSRand( ( uint32_t ) xTimeNow );
( void ) xApplicationGetRandomNumber( &ulRandomNumbers[ 0 ] );
( void ) xApplicationGetRandomNumber( &ulRandomNumbers[ 1 ] );
( void ) xApplicationGetRandomNumber( &ulRandomNumbers[ 2 ] );
( void ) xApplicationGetRandomNumber( &ulRandomNumbers[ 3 ] );
FreeRTOS_debug_printf( ( "Random numbers: %08X %08X %08X %08X\n",
ipconfigRAND32(),
ipconfigRAND32(),
ipconfigRAND32(),
ipconfigRAND32() ) );
ulRandomNumbers[ 0 ],
ulRandomNumbers[ 1 ],
ulRandomNumbers[ 2 ],
ulRandomNumbers[ 3 ] ) );
}
/*-----------------------------------------------------------*/