Learn R Programming

spbal (version 1.0.1)

cppBASpts: Generate numbers from a Halton Sequence.

Description

For efficiency, this function can generate points along a random start Halton Sequence for a predefined Halton.

Usage

cppBASpts(
  n = 10L,
  seeds = as.integer(c()),
  bases = as.numeric(c()),
  verbose = FALSE
)

Value

Matrix with the columns, order of points, x in [0,1) and y in [0,1)

Arguments

n

Number of points required.

seeds

Random starting point in each dimension.

bases

Co-prime base for the Halton Sequence.

verbose

A boolean indicating whether informational messages are to be issued.

Author

This function was first written in R by Blair Robertson, subsequently it was re-written in C/C++ by Phil Davies.

Examples

Run this code
# First 10 points in the Halton Sequence for base 2,3
spbal::cppBASpts(n = 10)
# First 10 points in the Halton Sequence for base 2,3 with
# starting point at the 15th and 22nd index.
spbal::cppBASpts(n = 10, seeds = c(14, 21))

Run the code above in your browser using DataLab