Welcome to the L3 Harris Geospatial documentation center. Here you will find reference guides and help documents.
﻿
>  Docs Center  >  Libraries  >  Salvaggio  >  RANDOM_SAMPLE

RANDOM_SAMPLE

## Name

RANDOM_SAMPLE

## Purpose

This function will return a vector of "n" random elements
selected from either a provided vector OR from a produced
vector of "N" elements using a long data index generator.
The returned random elements will be unique, that is, no
individual element in the array may be selected twice.

General.

## Calling Sequence

Result = \$
RANDOM_SAMPLE( seed, array, numberToSelect )

## Inputs

seed
A variable or constant used to initialize the random
sequence on input, and in which the state of the random
number generator is saved on output.
array
A one-dimensional vector containing the data from which
the random sample of specified size is to be selected
-OR- a scalar specifying the number of elements to be
placed in an array by the long data index generator
function from which the random sample will be selected
(this usage is recommended to produce random indices to
be used rather that directly selecting a random sample).
numberToSelect
The number of random samples to select from the provided
or generated vector.

None

## Restrictions

The numbetToSelect must be less than the length of the provided
or generated vector.

## Examples

EXAMPLE 1
seed = 135L
array = [ 9, 2, 3, 4, 6, 3 ]
numberToSelect = 2
sample = RANDOM_SAMPLE( seed, array, numberToSelect )
The above example will select 2 random elements from the supplied
array and return them in a 2-element vector.
EXAMPLE 2
seed = 135L
numberOfElements = 10
numberToSelect = 3
sample = RANDOM_SAMPLE( seed, NumberOfElements, numberToSelect )
The above example will select 2 random elements from a sequentially
filled array of 10 elements and return them in a 2-element vector.

## Return Value

Result is an array containing the parameters of the best fit model
determined during the RANSAC process.

None

None

## Modification History

Written by: Carl Salvaggio
September, 2008 Original code

## Disclaimer

This source code is provided "as is" and without warranties as to performance
or merchantability. The author and/or distributors of this source code may