Stride

OPEN / CLOSE
  • Features
  • Blog
  • Documentation
  • Community
(icon) Download

  • Discord
  • Facebook
  • Twitter
  • YouTube

LANGUAGE

OPEN / CLOSE
  • English
  • 日本語
    Show / Hide Table of Contents

    RandomSeed Struct

    Namespace: Stride.Core.Mathematics
    Assembly: Stride.Core.Mathematics.dll

    The RandomSeed is a structure for deterministically acquiring random values. One RandomSeed should be able to reproduce the same pseudo-random value for a fixed offset, but provide enough random distribution for different offsets or different random seeds Although other methods exist, the current implementation can easily be replicated in the shaders if required

    public struct RandomSeed
    Name Description
    Constructors
    RandomSeed(UInt32)

    Initializes a new instance of the RandomSeed struct from a target uint.

    Methods
    GetDouble(UInt32)

    Get a deterministic double value between 0 and 1 based on the seed

    GetFloat(UInt32)

    Get a deterministic float value between 0 and 1 based on the seed The calculations are still made as doubles to prevent underflow errors.

    | Improve this Doc View Source

    Constructors


    RandomSeed(UInt32)

    Initializes a new instance of the RandomSeed struct from a target uint.

    public RandomSeed(uint seed)
    Parameters
    Type Name Description
    System.UInt32 seed

    The seed value to initialize the deterministic random generator.

    | Improve this Doc View Source

    Methods


    GetDouble(UInt32)

    Get a deterministic double value between 0 and 1 based on the seed

    public double GetDouble(uint offset)
    Parameters
    Type Name Description
    System.UInt32 offset
    Returns
    Type Description
    System.Double

    Deterministic pseudo-random value between 0 and 1


    GetFloat(UInt32)

    Get a deterministic float value between 0 and 1 based on the seed The calculations are still made as doubles to prevent underflow errors.

    public float GetFloat(uint offset)
    Parameters
    Type Name Description
    System.UInt32 offset
    Returns
    Type Description
    System.Single

    Deterministic pseudo-random value between 0 and 1


    Inherited Members

    System.ValueType.Equals(System.Object)
    System.ValueType.GetHashCode()
    System.ValueType.ToString()

    Extension Methods

    ComponentBaseExtensions.DisposeBy<T>(T, ICollectorHolder)
    ComponentBaseExtensions.RemoveDisposeBy<T>(T, ICollectorHolder)
    • Improve this Doc
    • View Source
    In This Article

    Back to top

    Copyright © 2019-2021 .NET Foundation and Contributors
    Supported by the .NET Foundation