Class

net.psforever.objects.guid.selector

RandomSequenceSelector

Related Doc: package selector

Permalink

class RandomSequenceSelector extends NumberSelector

Get a pseudorandom number from a pool of numbers. The output of this class, operating on an Array of Int values is contained to some sequence of all the numbers. Only after every number is selected once, may any number repeat. The pseudorandomness of any sequence of numbers is not only provided by an internal system Random but by the order or returned numbers. Consequentially, as any single sequence nears completion, the numbers remaining become more and more predictable.

During the selection process:
The index is the position from where the selection begins, and the end of the Array is where the selection ends. Once a position between those two indices is selected, that number is extracted. The number at the start position is swapped into the position where the selection number was extracted. The start position is then set to an invalid number, and the start index is advanced. Repeat next request.

The return index trails behind the selection index as far as the order of the array is concerned at first. After some time, the selection index moves to the starting position of the array again and then the order is reversed. Until the return index wraps around to the beginning of the array too, it is considered the valid selection end position.

During the return process:
As the Array empties out from the first to the last index, the return process starts at the first index again. When a number is "returned," it is placed back into the input Array at the earliest available index. The return index is advanced. Neither the selection index nor the return index may pass each other, except when one reaches the end of the Array and wraps back around to that start.

Source
RandomSequenceSelector.scala
See also

RandomSelector

Linear Supertypes
NumberSelector, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. RandomSequenceSelector
  2. NumberSelector
  3. AnyRef
  4. Any
Implicitly
  1. by any2stringadd
  2. by StringFormat
  3. by Ensuring
  4. by ArrowAssoc
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new RandomSequenceSelector()

    Permalink

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. def +(other: String): String

    Permalink
    Implicit information
    This member is added by an implicit conversion from RandomSequenceSelector to any2stringadd[RandomSequenceSelector] performed by method any2stringadd in scala.Predef.
    Definition Classes
    any2stringadd
  4. def ->[B](y: B): (RandomSequenceSelector, B)

    Permalink
    Implicit information
    This member is added by an implicit conversion from RandomSequenceSelector to ArrowAssoc[RandomSequenceSelector] performed by method ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc
    Annotations
    @inline()
  5. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  6. def Format(ary: Array[Int]): Unit

    Permalink

    Accept the indexing pool from which numbers are selected and returned.

    Accept the indexing pool from which numbers are selected and returned. Correct its format to suit the current NumberSelector algorithms.

    Moving all of the invalid negative-ones (-1) to the left of the current valid indices works for most selectors. The selectionIndex is set to the first valid number available from the left. The ret index is set to index zero.

    ary

    the Array of Int numbers

    Definition Classes
    NumberSelector
  7. def Get(ary: Array[Int]): Int

    Permalink

    Accept a provided "pool of numbers" and select the next number.

    Accept a provided "pool of numbers" and select the next number.

    ary

    the Array of Int numbers from which to draw a new number

    returns

    an Int number

    Definition Classes
    RandomSequenceSelectorNumberSelector
  8. def Return(number: Int, ary: Array[Int]): Boolean

    Permalink

    Give a number back to a specific collection following the principles of this selector.

    Give a number back to a specific collection following the principles of this selector.

    number

    the number to be returned

    ary

    the Array of Int numbers to which the number is to be returned

    returns

    true, if this return was successful; false, otherwise

    Definition Classes
    RandomSequenceSelectorNumberSelector
  9. def ReturnIndex: Int

    Permalink
    Definition Classes
    NumberSelector
  10. def SelectionIndex: Int

    Permalink
    Definition Classes
    NumberSelector
  11. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  12. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  13. def ensuring(cond: (RandomSequenceSelector) ⇒ Boolean, msg: ⇒ Any): RandomSequenceSelector

    Permalink
    Implicit information
    This member is added by an implicit conversion from RandomSequenceSelector to Ensuring[RandomSequenceSelector] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  14. def ensuring(cond: (RandomSequenceSelector) ⇒ Boolean): RandomSequenceSelector

    Permalink
    Implicit information
    This member is added by an implicit conversion from RandomSequenceSelector to Ensuring[RandomSequenceSelector] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  15. def ensuring(cond: Boolean, msg: ⇒ Any): RandomSequenceSelector

    Permalink
    Implicit information
    This member is added by an implicit conversion from RandomSequenceSelector to Ensuring[RandomSequenceSelector] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  16. def ensuring(cond: Boolean): RandomSequenceSelector

    Permalink
    Implicit information
    This member is added by an implicit conversion from RandomSequenceSelector to Ensuring[RandomSequenceSelector] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  17. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  18. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  19. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  20. def formatted(fmtstr: String): String

    Permalink
    Implicit information
    This member is added by an implicit conversion from RandomSequenceSelector to StringFormat[RandomSequenceSelector] performed by method StringFormat in scala.Predef.
    Definition Classes
    StringFormat
    Annotations
    @inline()
  21. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  22. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  23. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  24. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  25. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  26. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  27. var ret: Int

    Permalink

    The index for the selector when performing a number return action, then modified for the "next" index.

    The index for the selector when performing a number return action, then modified for the "next" index.

    Attributes
    protected
    Definition Classes
    NumberSelector
  28. var selectionIndex: Int

    Permalink

    The index for the selector when performing a number selection action, then modified to the "next" index.

    The index for the selector when performing a number selection action, then modified to the "next" index.

    Attributes
    protected
    Definition Classes
    NumberSelector
  29. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  30. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  31. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  32. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  33. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  34. def [B](y: B): (RandomSequenceSelector, B)

    Permalink
    Implicit information
    This member is added by an implicit conversion from RandomSequenceSelector to ArrowAssoc[RandomSequenceSelector] performed by method ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc

Inherited from NumberSelector

Inherited from AnyRef

Inherited from Any

Inherited by implicit conversion any2stringadd from RandomSequenceSelector to any2stringadd[RandomSequenceSelector]

Inherited by implicit conversion StringFormat from RandomSequenceSelector to StringFormat[RandomSequenceSelector]

Inherited by implicit conversion Ensuring from RandomSequenceSelector to Ensuring[RandomSequenceSelector]

Inherited by implicit conversion ArrowAssoc from RandomSequenceSelector to ArrowAssoc[RandomSequenceSelector]

Ungrouped