import pyLHD
pyLHD.LatinSquare(size = (5,5),seed = 1)array([[2, 4, 1, 4, 2],
[4, 5, 3, 2, 4],
[1, 3, 4, 3, 3],
[5, 2, 2, 1, 1],
[3, 1, 5, 5, 5]])
base.LatinSquare(size, baseline=1, seed=None)
Generate a random (n x d) Latin square
| Name | Type | Description | Default |
|---|---|---|---|
size |
tuple of ints | Output shape of (n,d), where n and d are the number of rows and columns, respectively. |
required |
baseline |
int | A integer, which defines the minimum value for each column of the matrix. Defaults to 1. | 1 |
seed |
Optional[Union[int, np.random.Generator]]) | If seedis an integer or None, a new numpy.random.Generator is created using np.random.default_rng(seed). If seed is already a `Generator instance, then the provided instance is used. Defaults to None. |
None |
| Type | Description |
|---|---|
| numpy.numpy.ndarray | Generated random (n x d) Latin square, in which each column is a random permutation of {baseline,baseline+1, …, baseline+(n-1)} |
Examples: