tf_quant_finance.math.qmc.random_scrambling_vectors

Last updated: 2023-03-16.

tf_quant_finance.math.qmc.random_scrambling_vectors#

View source

Returns a Tensor drawn from a uniform distribution.

tf_quant_finance.math.qmc.random_scrambling_vectors(
    dim, seed, validate_args=False, dtype=None, name=None
)

The returned Tensor can be can be added to the specified generating_vectors in order to randomize it.

Examples#

import tf_quant_finance as tff

# Example: Creating random vectors which can scramble 2D generating vectors.

dim = 2
seed = (2, 3)

tff.math.qmc.random_scrambling_vectors(dim, seed=seed)
# ==> tf.Tensor([0.17481351, 0.9780868], shape=(2,), dtype=float32)

Args:#

  • dim: Positive scalar Tensor of integers with rank 0. The event size of points which can be sampled from the generating vectors to scramble.

  • seed: Positive scalar Tensor with shape [2] and dtype int32 used as seed for the random generator.

  • validate_args: Python bool indicating whether to validate arguments. Default value: False.

  • dtype: Optional dtype. The dtype of the output Tensor (either float32 or float64). Default value: None which maps to tf.float32.

  • name: Python str name prefixed to ops created by this function. Default value: None which maps to random_scrambling_vectors.

Returns:#

A Tensor of real values between 0 (incl.) and 1 (excl.) with shape (dim,).