User Tools

Site Tools


notes:discrete:fall2021:projects:saf0

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
notes:discrete:fall2021:projects:saf0 [2021/09/30 03:57] – Blurb about print function jlangtrynotes:discrete:fall2021:projects:saf0 [2021/10/06 23:47] (current) – Fixed minor typo smalik3
Line 34: Line 34:
  
 Surprisingly, one can create a randomized list of numbers in a specific range by not generating random numbers - but generating steadily iterated numbers and storing them in random array indices. This method theoretically saves time on checking to see whether a specific number has already been generated. Traditionally, one would have to increment through the entire array every time a random number is generated. With this method, one only has to check that the random array index is not already storing something or if it is nil. This is because the numbers that are stored increment with each loop - so it is guaranteed to be different. Theoretically, however, this could take just as long as the method where the array index is incremented if there is bad luck with choosing unused array indices. Surprisingly, one can create a randomized list of numbers in a specific range by not generating random numbers - but generating steadily iterated numbers and storing them in random array indices. This method theoretically saves time on checking to see whether a specific number has already been generated. Traditionally, one would have to increment through the entire array every time a random number is generated. With this method, one only has to check that the random array index is not already storing something or if it is nil. This is because the numbers that are stored increment with each loop - so it is guaranteed to be different. Theoretically, however, this could take just as long as the method where the array index is incremented if there is bad luck with choosing unused array indices.
 +
 +Random values do not just have their usage with random values in an array, but may be used to randomize the algorithm used depending on how the game will work.
  
 ==A Sort Synopsis== ==A Sort Synopsis==
Line 48: Line 50:
 Swapped : [1,4,5,7,9,10,1,8,2,6,3] (here, 4 and 1 changed places) Swapped : [1,4,5,7,9,10,1,8,2,6,3] (here, 4 and 1 changed places)
 </code> </code>
 +
  
 ====Display==== ====Display====
notes/discrete/fall2021/projects/saf0.1632974260.txt.gz · Last modified: 2021/09/30 03:57 by jlangtry