Random To: Difference between revisions

From StarLogo Nova Wiki
(Created page with "Category:Math <section begin="image"/>alt=The random to block|thumb<section end="image"/> <section begin="name" />'''{{Block|random [_] to [_]}}'''<section end="name" /> is a code block part of the Math drawer. ==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=== <code>random [number] to [n...")
 
(duplicate file already uploaded)
 
(11 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<languages/>
<translate>
<!--T:1-->
[[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>
 
<!--T:5-->
<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==
{{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===
==Usage== <!--T:6-->
<code>random [number] to [number]</code>
 
<!--T:7-->
{{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.
 
<!--T:2-->
==Syntax==
[[File:Random To Nums.png|right|alt=The Random to Block|thumb]]
<!-- <code>random [number] to [number]</code> -->
Inputs in this block:
#defines the lower limit
#defines the upper limit for the range of the generated random number.
 
<!--T:3-->
== 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. 
 
==Example== <!--T:8-->
 
<!--T:9-->
[[File:while_toggled_example.gif|alt=Random To example gif|thumb]]
[[File:while_toggled_example.png|alt=Random To example code|thumb]]


== Nuances ==
<!--T:10-->
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.   
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.   


<!--T:4-->
==Related Blocks==
==Related Blocks==
*{{Block|Left By Degs|left by [_] degs}}
*{{Block|Left By Degs|left by [_] degs}}
*{{Block|Right By Degs|right by [_] degs}}
*{{Block|Right By Degs|right by [_] degs}}
*{{Block|Random Decimal|random decimal}}
*{{Block|Random Decimal|random decimal}}
</translate>

Latest revision as of 18:16, 16 August 2023

Other languages:
The random to block

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

The Random to Block

Inputs in this block:

  1. defines the lower limit
  2. 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 the left by [_] degs combined with the forward[_] block, an agent will wander throughout Spaceland in a random direction.

Example

Random To example gif
Random To example code

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.

Related Blocks