randomNumber

randomNumber

Overview

The randomNumber function generates a random number from the specified range.

Note: In Zoho Creator, if the arguments are not specified, a completely random number is returned from the range 0 and 2 billion. While in other services, it is mandatory to supply the start and end values as arguments.

Return Type

  • NUMBER

Syntax for Zoho Creator

To generate a random number between 0 and 2 billion:

<variable>=randomNumber();

To generate a random number which falls in a specified range (inclusive of both values):

<variable>=randomNumber(<start_limit>, <end_limit>);

To generate a random number which falls below the specified number:

<variable>=randomNumber(<end_limit>);

Syntax for services other than Zoho Creator

<variable> = <start_limit>.randomNumber(<end_limit>);
ParameterData typeDescription
<variable>NUMBERVariable that will contain a random number between the specified limits.
<start_limit>NUMBER

The starting value of the range between which the random number needs to generated.

Note: This parameter is optional in Zoho Creator and mandatory in other services.

 

<end_limit>NUMBER

The ending value of the range between which the random number needs to generated.

Note:

  • This parameter is optional in Zoho Creator and mandatory in other services.
  • In Zoho Creator, when end_limit is specified along with start_limit, the function will include these values in the range and when end_limit is only specified, the function will not include this value in the range.

Examples that can be used in Zoho Creator

 response1= randomnumber();//returns a random number between 0 and 2 billion
 info response1;
 response2= randomnumber(1);//returns 0
 info response2;
 response3= randomnumber(1,2);//returns 1 or 2
 info response3;
 response4= randomnumber(1,100);//returns a random number between 1 and 100
 info response4;

Examples that can be used in all services except Zoho Creator

 response = 1.randomnumber(100);//returns a random number between 1 and 100 
 info response;

Share this post : FacebookTwitter

Still can't find what you're looking for?

Write to us: support@zohodeluge.com