Random To/en: Difference between revisions
(Updating to match new version of source page) |
(Updating to match new version of source page) |
||
Line 2: | Line 2: | ||
[[Category:Math]] | [[Category:Math]] | ||
<section begin="image"/>[[File:Random To.png|alt=The random to block|thumb]]<section end="image"/> | <section begin="image"/>[[File:Random To.png|alt=The random to block|thumb]]<section end="image"/><p id=tooltip>A random number between and including the limits.</p> | ||
<section begin="name" />'''{{Block|random [_] to [_]}}'''<section end="name" /> is a [[code block]] part of the [[Math]] drawer. | <section begin="name" />'''{{Block|random [_] to [_]}}'''<section end="name" /> is a [[code block]] part of the [[Math]] drawer. | ||
==Usage== | ==Usage== | ||
{{Block|random [_] to [_]}} defines the upper and lower bounds of a range from which a random number is generated. The number is generated between and including the set limits. | |||
==Syntax== | ==Syntax== | ||
Line 13: | Line 16: | ||
#defines the lower limit | #defines the lower limit | ||
#defines the upper limit for the range of the generated random number. | #defines the upper limit for the range of the generated random number. | ||
== Common Uses == | == Common Uses == | ||
*The {{Block|random [_] to [_]}} block is most commonly used for random movement. When inserted into a [[Movements]] block such as the {{#vardefineecho:cedol|<code>[[Left By Degs|left by [_] degs</code>]]}} combined with the {{#vardefineecho:cedol|<code>[[Forward|forward[_]</code>]]}} block, an agent will wander throughout [[Spaceland]] in a random direction. | *The {{Block|random [_] to [_]}} block is most commonly used for random movement. When inserted into a [[Movements]] block such as the {{#vardefineecho:cedol|<code>[[Left By Degs|left by [_] degs</code>]]}} combined with the {{#vardefineecho:cedol|<code>[[Forward|forward[_]</code>]]}} block, an agent will wander throughout [[Spaceland]] in a random direction. | ||
==Example== | |||
[[File:random_to_example.gif|alt=Random To example gif|thumb]] | |||
[[File:random_to_example.png|alt=Random To example code|thumb]] | |||
One of the most common uses of the ‘random to’ block is for random movement. As shown above, creating a random turn, and combining that with a [[Special:MyLanguage/Forward|forward]] block, allows an agent to wander throughout spaceland in a random direction. | |||
==Related Blocks== | ==Related Blocks== |
Revision as of 18:36, 14 August 2023
A random number between and including the limits.
random [_] to [_]
is a code block part of the Math drawer.
Usage
random [_] to [_]
defines the upper and lower bounds of a range from which a random number is generated. The number is generated between and including the set limits.
Syntax
Inputs in this block:
- defines the lower limit
- defines the upper limit for the range of the generated random number.
Common Uses
- The
random [_] to [_]
block is most commonly used for random movement. When inserted into a Movements block such as theleft by [_] degs
combined with theforward[_]
block, an agent will wander throughout Spaceland in a random direction.
Example
One of the most common uses of the ‘random to’ block is for random movement. As shown above, creating a random turn, and combining that with a forward block, allows an agent to wander throughout spaceland in a random direction.