Class GKRandomDistribution

  • All Implemented Interfaces:
    GKRandom, NSObject
    Direct Known Subclasses:
    GKGaussianDistribution, GKShuffledDistribution

    public class GKRandomDistribution
    extends NSObject
    implements GKRandom
    A random distribution is a random source itself with a specific mapping from the input source to the output values. The distribution is uniform, meaning there is no bias towards any of the possible outcomes.
    • Constructor Detail

      • GKRandomDistribution

        protected GKRandomDistribution​(org.moe.natj.general.Pointer peer)
    • Method Detail

      • accessInstanceVariablesDirectly

        public static boolean accessInstanceVariablesDirectly()
      • allocWithZone

        public static java.lang.Object allocWithZone​(org.moe.natj.general.ptr.VoidPtr zone)
      • automaticallyNotifiesObserversForKey

        public static boolean automaticallyNotifiesObserversForKey​(java.lang.String key)
      • cancelPreviousPerformRequestsWithTarget

        public static void cancelPreviousPerformRequestsWithTarget​(java.lang.Object aTarget)
      • cancelPreviousPerformRequestsWithTargetSelectorObject

        public static void cancelPreviousPerformRequestsWithTargetSelectorObject​(java.lang.Object aTarget,
                                                                                 org.moe.natj.objc.SEL aSelector,
                                                                                 java.lang.Object anArgument)
      • classFallbacksForKeyedArchiver

        public static NSArray<java.lang.String> classFallbacksForKeyedArchiver()
      • classForKeyedUnarchiver

        public static org.moe.natj.objc.Class classForKeyedUnarchiver()
      • d20

        public static java.lang.Object d20()
        Convenience creation for the very common d20 range [1, 20] with an isolated random source shielded from outside sources.
      • d6

        public static java.lang.Object d6()
        Convenience creation for the very common d6 range [1, 6] with an isolated random source shielded from outside sources.
      • debugDescription_static

        public static java.lang.String debugDescription_static()
      • description_static

        public static java.lang.String description_static()
      • distributionForDieWithSideCount

        public static GKRandomDistribution distributionForDieWithSideCount​(long sideCount)
        Convenience creation of random distribution with the die like range [1, sideCount] using an isolated source to grab input values from. This is equivalent to calling alloc followed by initWithSource:lowest:highest:, where source is [[GKRandomSource alloc] init].
      • distributionWithLowestValueHighestValue

        public static GKRandomDistribution distributionWithLowestValueHighestValue​(long lowestInclusive,
                                                                                   long highestInclusive)
        Convenience creation of random distribution within the range [lowest, highest] using an isolated source to grab input values from. This is equivalent to calling alloc followed by initWithSource:lowest:highest:, where source is [[GKRandomSource alloc] init].
      • hash_static

        public static long hash_static()
      • instanceMethodSignatureForSelector

        public static NSMethodSignature instanceMethodSignatureForSelector​(org.moe.natj.objc.SEL aSelector)
      • instancesRespondToSelector

        public static boolean instancesRespondToSelector​(org.moe.natj.objc.SEL aSelector)
      • isSubclassOfClass

        public static boolean isSubclassOfClass​(org.moe.natj.objc.Class aClass)
      • keyPathsForValuesAffectingValueForKey

        public static NSSet<java.lang.String> keyPathsForValuesAffectingValueForKey​(java.lang.String key)
      • new_objc

        public static java.lang.Object new_objc()
      • resolveClassMethod

        public static boolean resolveClassMethod​(org.moe.natj.objc.SEL sel)
      • resolveInstanceMethod

        public static boolean resolveInstanceMethod​(org.moe.natj.objc.SEL sel)
      • setVersion_static

        public static void setVersion_static​(long aVersion)
      • superclass_static

        public static org.moe.natj.objc.Class superclass_static()
      • version_static

        public static long version_static()
      • highestValue

        public long highestValue()
        The highest value the distribution will output.
      • initWithRandomSourceLowestValueHighestValue

        public GKRandomDistribution initWithRandomSourceLowestValueHighestValue​(GKRandom source,
                                                                                long lowestInclusive,
                                                                                long highestInclusive)
        Initializes a random distribution within the range [lowest, highest] using a source to grab input values from.
      • lowestValue

        public long lowestValue()
        The lowest value the distribution will output.
      • nextBool

        public boolean nextBool()
        Description copied from interface: GKRandom
        Returns the next true or false value in the random sequence and moves ahead to the next one. The value is either nonzero (true) or zero (false). Use this for simple boolean switches in logic that don't require fuzzy evaluation. For fuzzy evaluation use nextUniform. By default this should be based on nextIntWithUpperBound:. Implementations may base it on another representation if needed.
        Specified by:
        nextBool in interface GKRandom
        See Also:
        GKRandom.nextUniform()
      • nextInt

        public long nextInt()
        Description copied from interface: GKRandom
        Returns the next integer in the random sequence and moves ahead to the next one. The value is in the range of [INT32_MIN, INT32_MAX]. The lower bits are not guaranteed to be random so please use another property for simple choices.
        Specified by:
        nextInt in interface GKRandom
        See Also:
        GKRandom.nextBool(), GKRandom.nextUniform()
      • nextIntWithUpperBound

        public long nextIntWithUpperBound​(long upperBound)
        Description copied from interface: GKRandom
        Returns the next unsigned value in the random sequence that is less than upperBound. The value is in the range of [0, upperBound). Thus the value never equals or exceeeds upperBound. The unsigned nature and upper bound allows implementations to use logical shifts to return a value whose lower bits are more random than a similar call to nextInt. This is used to implement nextBool and nextUniform by default.
        Specified by:
        nextIntWithUpperBound in interface GKRandom
      • nextUniform

        public float nextUniform()
        Description copied from interface: GKRandom
        Returns the next uniform float in the random sequence and moves ahead to the next one. The value is in the range of [0.0, 1.0]. There is no weighting across the range so remapping this with a curve may give the best sampling distribution for your algorithm. By default this should be based on nextIntWithUpperBound:. Implementions may base it on another representation if needed.
        Specified by:
        nextUniform in interface GKRandom
        See Also:
        GKRandom.nextInt()
      • numberOfPossibleOutcomes

        public long numberOfPossibleOutcomes()
        The number of unique possible outcomes, depending on the distribution type this is not always highest - lowest + 1.