<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Name Generators Blog &#187; person</title>
	<atom:link href="http://www.name-generators.com/tag/person/feed" rel="self" type="application/rss+xml" />
	<link>http://www.name-generators.com</link>
	<description>Blogging about name generators</description>
	<lastBuildDate>Sun, 04 Dec 2011 17:28:32 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Choose random person</title>
		<link>http://www.name-generators.com/other-generators/choose-random-person.htm</link>
		<comments>http://www.name-generators.com/other-generators/choose-random-person.htm#comments</comments>
		<pubDate>Sun, 25 Jul 2010 08:44:09 +0000</pubDate>
		<dc:creator>Niels</dc:creator>
				<category><![CDATA[Other generators]]></category>
		<category><![CDATA[person]]></category>
		<category><![CDATA[random]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[student]]></category>

		<guid isPermaLink="false">http://www.name-generators.com/?p=218</guid>
		<description><![CDATA[I made a little script that choose a random person from a list. The background is that I got this mail from a reader, who need to  choose a random student from his class to answer questions. Tom wrote: I &#8230; <a href="http://www.name-generators.com/other-generators/choose-random-person.htm">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I made a little script that <strong>choose a random person</strong> from a list.</p>
<p>The background is that I got this mail from a reader, who need to  choose a random student from his class to answer questions.</p>
<p>Tom wrote:<br />
<em>I am a teacher and we have to randomly choose students to call and answer  questions.  Right now we use popsicle sticks with name on stick.  I would like to be  able to set up 4 classes,  type in the names of the students from the class and  have the app pick a name out of that class randomly.</em></p>
<p>Beside choosing persons randomly such a random app  also can be used to random pick all kinds of objects or items from a list. Script is programmed in JavaScript.</p>
<h3>Choose random person script</h3>
<p>Here&#8217;s a very simple but useful script, which choose a random student  from a list of names.</p>
<pre lang="javascript" line="1">function choose_student(){
    // Add your own student names to the class list
    var class_list =  ["Marge","Maggie","Lisa","Bart","Homer","Apu","Burns"];

    // Random numbers are made
    var randomNumber = parseInt(Math.random() * class_list.length);

    // Student are chosen from the class array with the random number
    var name = class_list[randomNumber];

    // Name is shown in alert box
    alert(name);
}</pre>
<ol>
<li>First you make an array (a list ) with the names of the persons you want to choose from</li>
<li>The Math.random() makes random numbers between 0 and 1. By multiplying it with the numbers of students of the list (found with the length function) and flooring it all with the parseInt() function, we will get a number between 0 and numbers of students in the class minus 1.</li>
<li>The person in the position of the random number is extracted from the list and saved in a variable. (the item in the first position in an array is called with the index number 0 like this: myArray[0])</li>
<li>Finally the chosen students name is shown in JavaScript alert box.</li>
</ol>
<p>And finally you just need to call the &#8220;choose random student&#8221;-function from your HTML.</p>
<pre>&lt;input type="button" value="Chose Random Student" onclick="choose_student()" /&gt;</pre>
<h3>Download example script</h3>
<p>You can download an example <a title="Choose random person script" href="http://www.name-generators.com/download/choose-random-person-script.zip">choose random person script</a> here. In the script you can find both the above pick random person script and the pick random student script I made for Tom. All is integrated in a complete HTML file ready to launch in your favorite browser.</p>
<p>The example script is integrated roughly into my name generator script, but it should give a good overview over how to accomplish the task of picking random persons from simple lists, and how to integrate a simple random application into a HTML page.</p>
<h3>Is it the above method truly random?</h3>
<p>In short no, but semi randomness is sufficient and adequate for the purpose of selecting random persons for none scientific reasons.</p>
<p>Read more about true <a title="Random numbers and random names" href="http://www.name-generators.com/name-generators/random-numbers-and-random-names.htm">random numbers and names</a>.</p>
<div style="margin: 12px 0px; font-family: arial; color: #333333; background: none repeat scroll 0% 0% #ffffff; border: 4px solid #e5e5e5; width: 100%; clear: left;">
<div class="CM_CTB_Content_Wrap" style="margin: 0px; padding: 0px; background-color: #ffffff;">
<div style="border-bottom: 1px solid #dcdcdc; white-space: nowrap; margin-bottom: 8px; background-color: #eeeeee; background-image: url(http://clipmarks.com/images/source-bg.gif); background-repeat: repeat-x; height: 24px; line-height: 24px; vertical-align: middle; padding-bottom: 4px; color: #666666; font-size: 10px;"><a title="see clips that are hot right now" href="http://clipmarks.com/clip-to-blog/"><img style="vertical-align: middle; margin: 0px 4px; display: inline; border: none; float: none;" src="http://content.clipmarks.com/blog_embed/6976dc14-ee2e-4322-ac1f-f85642294215/4905F106-063A-401C-8631-392E2E49652A/" border="0" alt="" width="19" height="19" /></a>clipped from <a style="font-size: 11px;" title="http://web.archive.org/web/20011027002011/http://dilbert.com/comics/dilbert/archive/images/dilbert2001182781025.gif" href="http://web.archive.org/web/20011027002011/http://dilbert.com/comics/dilbert/archive/images/dilbert2001182781025.gif">web.archive.org</a></div>
<blockquote style="text-align: left; padding: 0px 8px; margin: 4px 0px 8px 0px; background: transparent; border: none;" cite="http://web.archive.org/web/20011027002011/http://dilbert.com/comics/dilbert/archive/images/dilbert2001182781025.gif">
<div><img src="http://content9.clipmarks.com/blog_cache/web.archive.org/img/405B2A78-5499-474D-89B9-17F420F175C5" alt="http://web.archive.org/web/20011027002011/http://dilbert.com/comics/dilbert/archive/images/dilbert2001182781025.gif" /></div>
</blockquote>
</div>
<div style="margin: 0px 6px 6px 4px;">
<table style="font-size: 11px; border-spacing: 0px; padding: 0px;" cellspacing="0" cellpadding="0" width="100%">
<tbody>
<tr>
<td style="background: transparent; border-width: 0px; padding: 0px;"></td>
<td style="background: none repeat scroll 0% 0% transparent; border-width: 0px; padding: 0px; width: 107px;" width="107" align="right"><a title="blog or email this clip" href="http://clipmarks.com/share/4905F106-063A-401C-8631-392E2E49652A/blog/"><img style="border-width: 0px; padding: 0px; margin: 0px;" src="http://content6.clipmarks.com/images/c2b-foot.png" border="0" alt="blog it" width="107" height="17" /></a></td>
</tr>
</tbody>
</table>
</div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.name-generators.com/other-generators/choose-random-person.htm/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

