Maptitude GISDK Help |
Seeds the RandomNumber() function.
SetRandomSeed(integer seed_value)
Argument |
Contents |
seed_value |
A seed for the RandomNumber() function |
You can call SetRandomSeed() with a particular seed value, which will always create the same sequence of random numbers. This is useful when testing a procedure, so that results will be comparable.
To get different results every time your macro is run, you need to feed a "random" seed to SetRandomSeed(). The best way to generate good seed values is by using a time and/or date function, such as GetDateAndTime().
When the platform is initialized there is a call to SetRandomSeed() with a "random" seed based on the current time, so you do not need to call SetRandomSeed() to ensure randomness.
// Use current time in seconds past midnight as the random seed
t = GetDateAndTime() // For example, "Wed Oct 19 10:48:42 1994"
x = ParseString(t, " ") // {"Wed", "Oct", "19", "10:48:42", "1994"}
y = ParseString(x[4], ":") // hh:mm:ss -> {"hh","mm","ss"}
Seconds = s2i(y[1])*3600+s2i(y[2])*60+s2i(y[3]) // Seconds past midnight
SetRandomSeed(Seconds)
Function |
Summary |
Generates a random number between 0.0 and 1.0 |
|
Return an array of random samples of the given type of random distribution and parameters defined in the options array |
|
Determines the current date and time according to the system clock. |
©2025 Caliper Corporation | www.caliper.com |