# PSF-LoginServer - master - net.psforever.objects.guid.selector
PSF - LoginServer - master - net.psforever.objects.guid.selector
Keywords: PSF LoginServer master net.psforever.objects.guid.selector

PSF-LoginServer - master < Back


# Packages

-  package root
  Definition Classes
    root
-  package net
  Definition Classes
    root
-  package psforever
  Definition Classes
    net
-  package objects
  Definition Classes
    psforever
-  package guid
  Definition Classes
    objects
-  package actor
  Definition Classes
    guid
-  package key
  Definition Classes
    guid
-  package pool
  Definition Classes
    guid
-  package selector
  Definition Classes
    guid
- NumberSelector
- OpportunisticSelector
- RandomSelector
- RandomSequenceSelector
- SpecificSelector
- StrictInOrderSelector
-  package source
  Definition Classes
    guid

p

net.psforever.objects.guid

# selector

#### package selector

### Type Members

1.  abstract class NumberSelector extends AnyRef

   The base class for all different sorts of number selection policies.
   The `Array`s called out as method parameters is always an `Array` of indexes for some other list.

   The base class for all different sorts of number selection policies.
   The `Array`s called out as method parameters is always an `Array` of indexes for some other list. The indices in the `Array` are always the complete range of 0 to `n` numbers. It is recommended to initialize the `Array` with the rule `array(number) = number`. When they need to be flagged as "invalid" in some way, use some consistent system of negative numbers. (Recommendation: unless doing something fancy, just use -1.)

2.  class OpportunisticSelector extends NumberSelector

   Get whichever number is next available.

   Get whichever number is next available. It is similar to `StrictInOrderSelector` but it does not stop if it runs into an unavailable number. It attempts to get each number in its listed incrementally from a starting index. The search wraps back around to the zero index to the same start index if necessary.

3.  class RandomSelector extends NumberSelector

   Get a pseudorandom number from a pool of numbers.

   Get a pseudorandom number from a pool of numbers. The contained logic is similar to `RandomSequenceSelector`. It is not reliant of a shrinking pool that composes into some sequence of all the numbers, however; the numbers are re-introduced to the selection as long as the pool is used. This allows for the sequence to contain repeat numbers far before ever visiting all of the numbers once.
   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.
   During the return process:
   The returned number is added to the input `Array` at the position just before the current selection position. The selection index is then reversedback to re-include the returned number. The normal return index is not used in this algorithm.

   See also

     `RandomSequenceSelector`

4.  class RandomSequenceSelector extends NumberSelector

   Get a pseudorandom number from a pool of numbers.

   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.

   See also

     `RandomSelector`

5.  class SpecificSelector extends NumberSelector

   Get a specific number from a pool of numbers.

6.  class StrictInOrderSelector extends NumberSelector

   Get the next number in this pool incrementally.

   Get the next number in this pool incrementally. Starting at index 0, for example, select each subsequent number as it is available. Do not progress if a number is not available when requested.

### Ungrouped