<?xml version="1.0" encoding="UTF-8"?>
<post>
  <body>It depends from the range of the random number:
&lt;pre&gt;&lt;code&gt;
var maxValue=50;
var randomNumber=Math.random(); //Range 0-1;
var range1=Math.floor(maxValue*randomNumber); //Range 0-49
var range2=Math.ceil(maxValue*randomNumber); //Range 1-50
var range3=Math.round(maxValue*randomNumber); //Range 0-50, but 0 and 50 have half probability than all other numbers 

//this works also fine
location.pathname=range1; //or range2 or range3
&lt;/code&gt;&lt;/pre&gt;</body>
  <body-html>&lt;p&gt;It depends from the range of the random number:
&lt;br /&gt;&lt;pre&gt;&lt;code&gt;
var maxValue=50;
var randomNumber=Math.random(); //Range 0-1;
var range1=Math.floor(maxValue*randomNumber); //Range 0-49
var range2=Math.ceil(maxValue*randomNumber); //Range 1-50
var range3=Math.round(maxValue*randomNumber); //Range 0-50, but 0 and 50 have half probability than all other numbers 

//this works also fine
location.pathname=range1; //or range2 or range3
&lt;/code&gt;&lt;/pre&gt;&lt;/p&gt;</body-html>
  <created-at type="datetime">2008-10-18T17:18:42Z</created-at>
  <forumable-id type="integer">2</forumable-id>
  <forumable-type>Forum</forumable-type>
  <id type="integer">16314</id>
  <topic-id type="integer">9414</topic-id>
  <updated-at type="datetime">2008-10-18T17:18:42Z</updated-at>
  <user-agent nil="true"></user-agent>
  <user-id type="integer">28612</user-id>
</post>
