Accelerating the pace of engineering and science

• Trials

# scramble

Class: qrandset

Scramble quasi-random point set

## Syntax

ps = scramble(p,type)
ps = scramble(p,'clear')
ps = scramble(p)

## Description

ps = scramble(p,type) returns a scrambled copy ps of the point set p of the qrandset class, created using the scramble type specified in the string type. Point sets from different subclasses of qrandset support different scramble types, as indicated in the following table.

SubclassScramble Types
haltonset

'RR2' — A permutation of the radical inverse coefficients derived by applying a reverse-radix operation to all of the possible coefficient values. The scramble is described in [1].

sobolset

'MatousekAffineOwen' — A random linear scramble combined with a random digital shift. The scramble is described in [2].

ps = scramble(p,'clear') removes all scramble settings from p and returns the result in ps.

ps = scramble(p) removes all scramble settings from p and then adds them back in the order they were originally applied. This typically results in a different point set because of the randomness of the scrambling algorithms.

## Examples

Use haltonset to generate a 3-D Halton point set, skip the first 1000 values, and then retain every 101st point:

```p = haltonset(3,'Skip',1e3,'Leap',1e2)
p =
Halton point set in 3 dimensions (8.918019e+013 points)
Properties:
Skip : 1000
Leap : 100
ScrambleMethod : none```

Use scramble to apply reverse-radix scrambling:

```p = scramble(p,'RR2')
p =
Halton point set in 3 dimensions (8.918019e+013 points)
Properties:
Skip : 1000
Leap : 100
ScrambleMethod : RR2```

Use net to generate the first four points:

```X0 = net(p,4)
X0 =
0.0928    0.6950    0.0029
0.6958    0.2958    0.8269
0.3013    0.6497    0.4141
0.9087    0.7883    0.2166```

Use parenthesis indexing to generate every third point, up to the 11th point:

```X = p(1:3:11,:)
X =
0.0928    0.6950    0.0029
0.9087    0.7883    0.2166
0.3843    0.9840    0.9878
0.6831    0.7357    0.7923```

## References

[1] Kocis, L., and W. J. Whiten. "Computational Investigations of Low-Discrepancy Sequences." ACM Transactions on Mathematical Software. Vol. 23, No. 2, 1997, pp. 266–294.

[2] Matousek, J. "On the L2-Discrepancy for Anchored Boxes." Journal of Complexity. Vol. 14, No. 4, 1998, pp. 527–556.