## Miscellaneous Factors

This page lists the remaining built-in methods, which have not already been covered. In these methods, you can often pass in random variables as arguments e.g. Variable<Vector> instead of Vector. For compactness, this is not shown in the syntax below.

These methods provide a convenient short alternative to using Variable<T>.Factor and passing in the factor method, as described on this page

 Operation Syntax Description Subarray Variable.Subarray(T[] array, int[] indices) Create a T[] random variable array by extracting elements of array at the specified indices, which cannot include duplicates. Subarray should be used instead of GetItems, whenever you can be sure that there are no duplicates, since it is more efficient. GetItems Variable.GetItems(T[] array, int[] indices) Create a T[] random variable array by extracting elements of array at the specified indices, which may include duplicates. Some uses of GetItems can also be achieved through indexing. If there are no duplicate indices, Subarray should be used instead. Enum to int Variable.EnumToInt(TEnum enumVar) Create an int random variable corresponding to the supplied enum random variable.  This allows enums to be used as arguments to  Variable.Case() or Variable.Switch(). Vector from array Variable.Vector(array) Create a Vector random variable corresponding the supplied array of random doubles. Array from vector Variable.ArrayFromVector(vector) Create an array of double random variables corresponding to the elements of the supplied random Vector.  This is more efficient than calling GetItem on each element. Concat Variable.Concat(first, second) Concatenates two random Vectors. Subvector Variable.Subvector(vector, startIndex, count) Extract contiguous elements from a random vector. GetItem Variable.GetItem(vector, index) Extract an element of a random vector. FunctionEvaluate Variable.FunctionEvaluate(func, x) Evaluate a random function at a point.  Used to construct Gaussian Process models like this one.