ASP function rnd ()
function rnd () returns a random number from 0 to 1.
Use the following methods:
Copy Code code as follows:
Response.Write Rnd () ' Its possible return value: 0.2357746
If you want to use the Rnd ()
1: random number generator
ClassRandomIs A. Net pseudo-random number generator. To generate various types of random numbers, you must first obtain its instance object and then generate a random number.
2: Seeds
The random number is generated
Blocking the current thread for a short time
Random rnd1 = new random ();
System. threading. thread. sleep (500 );
Random rnd2 = new random ();
Or, use an algorithm to differentiate the seed values of each call.
For example, the following code uses
Iamlasong
VBA programming achieves random output without repeating. The random function in VBA is RND, and the random function in worksheet is Rand. The difference between the word and can be remembered. The RND value range is [0, 1). It indicates a
CopyCode The Code is as follows: using system;
Using system. Data;
Using system. configuration;
Using system. Web;
Using system. Web. Security;
Using system. Web. UI;
Using system. Web. UI. webcontrols;
Using system. Web. UI. webcontrols.
Copy Code code as follows:
Using System;
Using System.Data;
Using System.Configuration;
Using System.Web;
Using System.Web.Security;
Using System.Web.UI;
Using System.Web.UI.WebControls;
Using System.Web.UI.WebControls.WebParts;
Using
By default,. Net random numbers are generated based on the system time. If the computer speed is very fast, the random numbers will be the same.
Random RND = new random ();
Int rndnum = RND. Next (); // random number within the int value range
Int
Int
Myran
=
10
;
//
Initialize myran
Public
Static
Int
Genforint (
Int
Minvalue,
Int
Maxvalue,
Ref
Int
Myran)
//
Auto generate random int data
{Random ran
=
New
Random ();
Int
1. Javascript random number function math. Random ()
Generate random numbers within a specified range
The math. Random () method has no parameters. 0 ~ is returned ~ Random number between 1. If 0 ~ is to be generated ~ Random between N
Number,
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.