Proceed to WirelessDevNet Home Page
Publications, e-books, and more! Community Tutorials Store Downloads, tools, & Freebies! IT Career Center News Home
newnav.gif

Newsletters
EMail Address:



   Content
  - Articles
  - Columns
  - Training
  - Library
  - Glossary
 
   Career Center
  - Career Center Home
  - View Jobs
  - Post A Job
  - Resumes/CVs
  - Resource Center
 
   Marketplace
  - Marketplace Home
  - Software Products
  - Wireless Market Data
  - Technical Books
 
   News
  - Daily News
  - Submit News
  - Events Calendar
  - Unsubscribe
  - Delivery Options
 
   Community
  - Discussion Boards
  - Mailing List
  - Mailing List Archives
 
   About Us
  - About WirelessDevNet
  - Wireless Source Disks
  - Partners
  - About MindSites Group
  - Advertising Information
 
WMLScript Reference WMLScript Reference

WMLScript > Lang > seed()

seed() - The seed Function

Usage:  
seed(value)
Description:  Initialises the pseudo-random number sequence and returns an empty string. If the value is zero or a positive integer then the give value is used for initialisation, otherwise a random, system dependent initialisation value is used. A seed value of greater than or equal to zero results in a repeatable sequence of pseudo-random numbers. A seed value of less than zero results in a non-repeatable sequence of random numbers.

If the value is of type floating-point, Float.int() is first used to calculate the actual integer value. If the value is non-numeric, invalid is returned and the current seed is unchanged.


Example:
var a = Lang.seed(123);     // a = ""
var b = Lang.random(20);    // b = 0..20
var c = Lang.seed("seed");  // c = invalid (random seed left unchanged)

Lang.seed(7);               
var a = Lang.rand(10);      // a = 4(perhaps)
Lang.seed(7);
var b = Lang.rand(10);      // b = 4(perhaps, but same as a)
Lang.seed(-1);
var c = Lang.rand(10);      // c = 6(perhaps)
Lang.seed(-1);
var d = Lang.rand(10);      // d = 1(perhaps, but not necessarily the same as c)




Bookmark this page
Sponsors

Search

Eliminate irrelevant hits with our industry-specific search engine!









Wireless Developer Network - A MindSites Group Trade Community
Copyright© 2000-2010 MindSites Group / Privacy Policy
Send Comments to:
feedback@wirelessdevnet.com