<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="https://wiki.zenerves.net/skins/common/feed.css?301"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-gb">
		<id>https://wiki.zenerves.net/index.php?action=history&amp;feed=atom&amp;title=Random</id>
		<title>Random - Revision history</title>
		<link rel="self" type="application/atom+xml" href="https://wiki.zenerves.net/index.php?action=history&amp;feed=atom&amp;title=Random"/>
		<link rel="alternate" type="text/html" href="https://wiki.zenerves.net/index.php?title=Random&amp;action=history"/>
		<updated>2026-04-21T09:43:09Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.17.0</generator>

	<entry>
		<id>https://wiki.zenerves.net/index.php?title=Random&amp;diff=184&amp;oldid=prev</id>
		<title>Admin: 1 revision</title>
		<link rel="alternate" type="text/html" href="https://wiki.zenerves.net/index.php?title=Random&amp;diff=184&amp;oldid=prev"/>
				<updated>2011-10-14T23:59:14Z</updated>
		
		<summary type="html">&lt;p&gt;1 revision&lt;/p&gt;
&lt;table style=&quot;background-color: white; color:black;&quot;&gt;
		&lt;tr valign='top'&gt;
		&lt;td colspan='1' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
		&lt;td colspan='1' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 23:59, 14 October 2011&lt;/td&gt;
		&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	<entry>
		<id>https://wiki.zenerves.net/index.php?title=Random&amp;diff=183&amp;oldid=prev</id>
		<title>Lola at 23:37, 14 October 2011</title>
		<link rel="alternate" type="text/html" href="https://wiki.zenerves.net/index.php?title=Random&amp;diff=183&amp;oldid=prev"/>
				<updated>2011-10-14T23:37:21Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Random Moves adds something very subtle to your bot; for any animal creation they are essential I believe; let's have a look at the basic syntax: &lt;br /&gt;
&lt;br /&gt;
 task main()              // Start of Code&lt;br /&gt;
 {&lt;br /&gt;
   while(true)            // This just tells the snippet to go on ad on forever, since ther is nothing else to counter the ''while'' statement.&lt;br /&gt;
   {&lt;br /&gt;
     OnFwd(OUT_AC, 75);   // Forward @ 75% of power&lt;br /&gt;
     Wait(Random(600));   // For a duration random between 0 to 0.6 secs&lt;br /&gt;
     OnRev(OUT_A, 75);    // Then Backwards,&lt;br /&gt;
     Wait(Random(400));   // For a random something between 0 and 0.4 secs.&lt;br /&gt;
   }                      // Mind the { and }  or it won't compile; '''kate''' would help you with colour and lines joining them&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
You'll notice this is quite simple: instead of giving a time parameter, you'll just write down Random(Field of Randomness) instead; In the above sample the 'Bot will go forward for any time between 0 to 600 millsecs, then go back for any value between 0 to 400 millisecs; That will give it a quite drunken behaviour!&lt;br /&gt;
&lt;br /&gt;
If for calculation purpose, you need Real Full Blown Randowness, just write Random() this will return anything from -infinite to +infinite; it's actually your best shot at a &amp;quot;flip the coin&amp;quot; decision-making process&lt;br /&gt;
&lt;br /&gt;
Randomization can be used at any place any figure would be entered, so Speed is a valid option too. And, last but not least, a random output can be a [[Integer]] too, let's re-work the simple script above to More randomness, with [[Integers]]:&lt;br /&gt;
&lt;br /&gt;
 int move_time, turn_time;         //Define some integers&lt;br /&gt;
 int fwd_speed, bck_speed;         //Define some integers&lt;br /&gt;
 &lt;br /&gt;
 task main()                       // Start of Code&lt;br /&gt;
 {&lt;br /&gt;
   while(true)                     // This just tells the snippet to go on ad on forever&lt;br /&gt;
   {&lt;br /&gt;
     move_time = Random(600);      // random between 0 to 0.6 secs&lt;br /&gt;
     turn_time = Random(400);      // For a random something between 0 and 0.4 secs.&lt;br /&gt;
     fwd_speed = Random(90);       // random between 0 to 90% power&lt;br /&gt;
     bck_speed = Random(70);       // random between 0 to 70% power&lt;br /&gt;
 &lt;br /&gt;
     OnFwd(OUT_AC, fwd_speed);     // See '''fwd_speed = Random(90);'''&lt;br /&gt;
     Wait(move_time);              // See '''move_time = Random(600);'''&lt;br /&gt;
     OnRev(OUT_A, bck_speed);      // See '''bck_speed = Random(70); '''&lt;br /&gt;
     Wait(turn_time);              // See '''turn_time = Random(400);'''&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
That's it, the Thing will go forward at a random speed between 0 and 90% of power for a random amount of time included between 0 to 0.6 seconds, and quite the same, while with slightly different values, will happen backwards too.&lt;br /&gt;
&lt;br /&gt;
Now that poses athreat: Immobilism; all this randomness may well generate values of ''Zero'' and your 'bot won'yt move, whis isn't fun.&lt;br /&gt;
&lt;br /&gt;
For your next Lessons on Randomness, may I suggest you head over [[Drunken tribot v1|here]], [[Drunken tribot v2|here]] and [[Drunken tribot v3|there]]?&lt;br /&gt;
&lt;br /&gt;
See you again on our Not Quite Encyclopedic resource.&lt;br /&gt;
[[Category:NXT]] [[Category:Snippets]]&lt;/div&gt;</summary>
		<author><name>Lola</name></author>	</entry>

	</feed>