Siebel eScript Language Reference > Methods Reference > Mathematical Methods >

Get Random Number Method


The Get Random Number method creates, and then returns a pseudo-random number between 0 and 1. It uses no arguments.

Where possible, you must use the Get Random Number method instead of the Clib Create Random Number method. You use the Clib Create Random Number method only if you must use the Clib Initialize Random Number Generator method to create an initial value for the random number generator. For more information, see the following topics:

Format

Math.random()

Example

The following example creates a random string of characters in a range. The Get Random Number method sets the range between lowercase letter a through lowercase letter z:

function Test_Click ()
{
   var str1 = "";
   var letter;
   var randomvalue;
   var upper = "z";
   var lower = "a";

   upper = upper.charCodeAt(0);
   lower = lower.charCodeAt(0);

   for (var x = 1; x < 26; x++)
   {
      randomvalue = Math.round(((upper - (lower + 1)) *
         Math.random()) + lower);
      letter = String.fromCharCode(randomvalue);
      str1 = str1 + letter;
   }

   TheApplication().RaiseErrorText(str1);
}

Siebel eScript Language Reference Copyright © 2013, Oracle and/or its affiliates. All rights reserved. Legal Notices.