User Tools

Site Tools


en:examples:maths:generating_random_numbers

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
en:examples:maths:generating_random_numbers [2019/11/17 00:18 (4 years ago)] sausageen:examples:maths:generating_random_numbers [2019/11/17 00:22 (4 years ago)] (current) – [Code] sausage
Line 6: Line 6:
 //somewhere in the init //somewhere in the init
 orxMath_InitRandom((orxS32)orxSystem_GetRealTime()); //a good seeding value orxMath_InitRandom((orxS32)orxSystem_GetRealTime()); //a good seeding value
 +</code>
  
 This also will ensure your random values from your Data Config are also properly randomised. See also [[en:examples:spawners:spawning_random_objects|Spawning Random Objects]] as a practical example of using random values. This also will ensure your random values from your Data Config are also properly randomised. See also [[en:examples:spawners:spawning_random_objects|Spawning Random Objects]] as a practical example of using random values.
  
 +<code=c>
 //elsewhere, a random number between 1 and 100 //elsewhere, a random number between 1 and 100
 orxFLOAT randomNumber = orxMath_GetRandomFloat(1, 100); orxFLOAT randomNumber = orxMath_GetRandomFloat(1, 100);
en/examples/maths/generating_random_numbers.txt · Last modified: 2019/11/17 00:22 (4 years ago) by sausage