# Template Class scrambled_sobol32_engine

- Defined in File hiprand.hpp

## Class Documentation

template<unsigned int DefaultNumDimensions = 1>
class scrambled_sobol32_engine

  Sobol’s quasi-random sequence generator.

  scrambled_sobol32_engine is a quasi-random number engine which produces scrambled Sobol sequences. This implementation supports generating sequences in up to 20,000 dimensions. The engine produces random unsigned integers on the interval [0; 2^32 - 1].

  Public Types

  typedef unsigned int result_type

    Type of values generated by the random number engine.

  typedef unsigned long long offset_type

    Pseudo-random number engine offset type. Offset represents a number of the random number engine’s states that should be skipped before first value is generated.

    See also: offset()

  typedef unsigned int dimensions_num_type

    Quasi-random number engine type for number of dimensions.

    See also dimensions()

  Public Functions

  inline scrambled_sobol32_engine(dimensions_num_type num_of_dimensions = DefaultNumDimensions, offset_type offset_value = 0)

    Constructs the pseudo-random number engine.

    See also: hiprandCreateGenerator()

    Parameters:

      - num_of_dimensions – - number of dimensions to use in the initialization of the internal state, see also dimensions()

      - offset_value – - number of internal states that should be skipped, see also offset()

  inline scrambled_sobol32_engine(hiprandGenerator_t &generator)

    Constructs the pseudo-random number engine.

    The pseudo-random number engine will be created using `generator`. The constructed engine take ownership over `generator`, and sets passed reference to `NULL`. The lifetime of `generator` is now bound to the lifetime of the engine.

    Parameters:

      generator – - hipRAND generator

  scrambled_sobol32_engine(const scrambled_sobol32_engine&) = delete
  scrambled_sobol32_engine(scrambled_sobol32_engine&&) = delete
  scrambled_sobol32_engine &operator=(const scrambled_sobol32_engine&) = delete
  scrambled_sobol32_engine &operator=(scrambled_sobol32_engine&&) = delete
  inline ~scrambled_sobol32_engine() noexcept(false)

    Destructs the engine.

    See also: hiprandDestroyGenerator()

  inline void stream(hipStream_t value)

    Sets the random number engine’s `hipStream` for kernel launches.

    Parameters:

      value – - new `hipStream` to use

  inline void offset(offset_type value)

    Sets the offset of a random number engine.

    Offset represents a number of the random number engine’s states that should be skipped before first value is generated.

    - This operation resets the engine’s internal state.

    - This operation does not change the engine’s seed or the number of dimensions.

    See also: hiprandSetGeneratorOffset()

    Parameters:

      value – - New absolute offset

  inline void dimensions(dimensions_num_type value)

    Set the number of dimensions of a quasi-random number generator.

    Supported values of `dimensions` are 1 to 20000.

    - This operation resets the generator’s internal state.

    - This operation does not change the generator’s offset.

    See also: hiprandSetQuasiRandomGeneratorDimensions()

    Parameters:

      value – - Number of dimensions

  template<class Generator>
  inline void operator()(result_type *output, size_t size)
  inline result_type min() const

    Returns the smallest possible value that can be generated by the engine.

  inline result_type max() const

    Returns the largest possible value that can be generated by the engine.

  Public Static Functions

  static inline constexpr hiprandRngType type()

    Returns type of the hipRAND pseudo-random number generator associated with the engine.

  Public Static Attributes

  static constexpr dimensions_num_type default_num_dimensions = DefaultNumDimensions

    The default number of dimenstions, equal to `DefaultNumDimensions`.