John, 
 
The code to populate a column with random numbers is: 
 
Update MyTable Set RandCol = rnd(1) 
 
where rnd(1) is the function that generates a random number (0 < n < 1). 
 
You may also need to use the Randomize command: 
 
"The Randomize statement "seeds" the random number generator so that later 
calls to the Rnd(
) function produce random results. Without this statement before the first call 
to Rnd( ), the
actual series of random numbers will follow a standard list. In other words, 
unless the program
includes a Randomize statement, the sequence of values returned by Rnd( ) will 
follow the
same pattern each time the application is run.
The Randomize statement is only needed once in a program and should occur prior 
to the first
call to the Rnd( ) function.
If you include the With clause, the seed parameter is used as the seed value 
for the pseudorandom
number generator. If you omit the With clause, MapBasic automatically seeds the
pseudo-random number generator using the current system clock. Use the With 
clause if you
need to create repeatable test scenarios, where your program generates 
repeatable sequences of
"random" numbers." MapBasic Manual. 
 
 
Ian

>>> "John Nott" <[EMAIL PROTECTED]> 26/10/2005 10:37:59 >>>

Hello List,

I have a table of about 5,000 sites. What I would like to do is select a
spatially random distribution of about say10% or so of these. Does
anyone know a way of doing this in MI. I suppose I could add a row ID
and do a random number generation is Excel but it would be useful for
future reference.

Thanks for any help you can offer!!

All the best,

John


Reply via email to