<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Getting random number between range of two numbers in JavaScript</title>
	<atom:link href="http://roshanbh.com.np/2008/09/get-random-number-range-two-numbers-javascript.html/feed" rel="self" type="application/rss+xml" />
	<link>http://roshanbh.com.np/2008/09/get-random-number-range-two-numbers-javascript.html</link>
	<description>Useful Tutorials, Scripts , Tips, and Resources for all PHP and Ajax beginners and experts .</description>
	<lastBuildDate>Mon, 07 May 2012 21:11:05 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Darrel</title>
		<link>http://roshanbh.com.np/2008/09/get-random-number-range-two-numbers-javascript.html/comment-page-1#comment-6461</link>
		<dc:creator>Darrel</dc:creator>
		<pubDate>Wed, 16 Mar 2011 22:37:57 +0000</pubDate>
		<guid isPermaLink="false">http://roshanbh.com.np/?p=291#comment-6461</guid>
		<description>I have started to use jPaq and found that they have a function called Math.randomIn.  This function seems to offer the same functionality.  I found it here: http://jpaq.org/documentation/Math.randomIn%28%29/1.0/</description>
		<content:encoded><![CDATA[<p>I have started to use jPaq and found that they have a function called Math.randomIn.  This function seems to offer the same functionality.  I found it here: <a href="http://jpaq.org/documentation/Math.randomIn%28%29/1.0/" rel="nofollow">http://jpaq.org/documentation/Math.randomIn%28%29/1.0/</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Joseph</title>
		<link>http://roshanbh.com.np/2008/09/get-random-number-range-two-numbers-javascript.html/comment-page-1#comment-6445</link>
		<dc:creator>Joseph</dc:creator>
		<pubDate>Sat, 05 Mar 2011 19:10:51 +0000</pubDate>
		<guid isPermaLink="false">http://roshanbh.com.np/?p=291#comment-6445</guid>
		<description>Thank you so much!!! now I can generate a range of years.  I generated a random year between 2011 - 2112</description>
		<content:encoded><![CDATA[<p>Thank you so much!!! now I can generate a range of years.  I generated a random year between 2011 &#8211; 2112</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nate</title>
		<link>http://roshanbh.com.np/2008/09/get-random-number-range-two-numbers-javascript.html/comment-page-1#comment-5215</link>
		<dc:creator>Nate</dc:creator>
		<pubDate>Tue, 02 Mar 2010 17:11:17 +0000</pubDate>
		<guid isPermaLink="false">http://roshanbh.com.np/?p=291#comment-5215</guid>
		<description>here is a link to jsbin.com to see the histogram, give it a try:
http://jsbin.com/ihaqi/3/edit</description>
		<content:encoded><![CDATA[<p>here is a link to jsbin.com to see the histogram, give it a try:<br />
<a href="http://jsbin.com/ihaqi/3/edit" rel="nofollow">http://jsbin.com/ihaqi/3/edit</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nate</title>
		<link>http://roshanbh.com.np/2008/09/get-random-number-range-two-numbers-javascript.html/comment-page-1#comment-5214</link>
		<dc:creator>Nate</dc:creator>
		<pubDate>Tue, 02 Mar 2010 15:16:31 +0000</pubDate>
		<guid isPermaLink="false">http://roshanbh.com.np/?p=291#comment-5214</guid>
		<description>The rounding causes a favoring in the middle of the range, not an even distribution:
For example: randomXToY(0, 2) will return 1 half of the time and 0 a 1/4th of the time and 2 also just 1/4 of the time.  

maybe a better way is to use floor and  you have to up the range by one unit of granularity.
function randomMinToMax(min, max)
    var range = max - min + 1;
    return Math.floor(Math.random()*range+min);
}</description>
		<content:encoded><![CDATA[<p>The rounding causes a favoring in the middle of the range, not an even distribution:<br />
For example: randomXToY(0, 2) will return 1 half of the time and 0 a 1/4th of the time and 2 also just 1/4 of the time.  </p>
<p>maybe a better way is to use floor and  you have to up the range by one unit of granularity.<br />
function randomMinToMax(min, max)<br />
    var range = max &#8211; min + 1;<br />
    return Math.floor(Math.random()*range+min);<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: pligg.com</title>
		<link>http://roshanbh.com.np/2008/09/get-random-number-range-two-numbers-javascript.html/comment-page-1#comment-4937</link>
		<dc:creator>pligg.com</dc:creator>
		<pubDate>Thu, 17 Dec 2009 20:01:53 +0000</pubDate>
		<guid isPermaLink="false">http://roshanbh.com.np/?p=291#comment-4937</guid>
		<description>&lt;strong&gt;Getting random number between range of two numbers in JavaScript...&lt;/strong&gt;

Yesterday, Steve asked me how can we have random number function in JavaScript like rand() function of PHP where the programmer can specify the range of two numbers within which we need the random number. Today, I&#039;m going to share two functions in Jav...</description>
		<content:encoded><![CDATA[<p><strong>Getting random number between range of two numbers in JavaScript&#8230;</strong></p>
<p>Yesterday, Steve asked me how can we have random number function in JavaScript like rand() function of PHP where the programmer can specify the range of two numbers within which we need the random number. Today, I&#8217;m going to share two functions in Jav&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Data Outsourcing India</title>
		<link>http://roshanbh.com.np/2008/09/get-random-number-range-two-numbers-javascript.html/comment-page-1#comment-4301</link>
		<dc:creator>Data Outsourcing India</dc:creator>
		<pubDate>Fri, 31 Jul 2009 15:29:15 +0000</pubDate>
		<guid isPermaLink="false">http://roshanbh.com.np/?p=291#comment-4301</guid>
		<description>Thanks Buddy!!! 
Its really helpful, getting random number in JavaScript.</description>
		<content:encoded><![CDATA[<p>Thanks Buddy!!!<br />
Its really helpful, getting random number in JavaScript.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: sohbet</title>
		<link>http://roshanbh.com.np/2008/09/get-random-number-range-two-numbers-javascript.html/comment-page-1#comment-4165</link>
		<dc:creator>sohbet</dc:creator>
		<pubDate>Thu, 02 Jul 2009 13:22:29 +0000</pubDate>
		<guid isPermaLink="false">http://roshanbh.com.np/?p=291#comment-4165</guid>
		<description>hi good thank you master</description>
		<content:encoded><![CDATA[<p>hi good thank you master</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: David</title>
		<link>http://roshanbh.com.np/2008/09/get-random-number-range-two-numbers-javascript.html/comment-page-1#comment-3387</link>
		<dc:creator>David</dc:creator>
		<pubDate>Tue, 23 Dec 2008 17:43:14 +0000</pubDate>
		<guid isPermaLink="false">http://roshanbh.com.np/?p=291#comment-3387</guid>
		<description>Great post. The random between function is pretty helpful.</description>
		<content:encoded><![CDATA[<p>Great post. The random between function is pretty helpful.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced
Database Caching 1/12 queries in 0.012 seconds using disk: basic
Object Caching 302/303 objects using disk: basic

Served from: roshanbh.com.np @ 2012-05-21 18:58:42 -->
