示例#1
0
  /**
   * This method is discouraged for normal use. Initializes the stream at the beginning of a stream
   * with the initial seed <TT>seed[0..24]</TT>. The seed must satisfy the same conditions as in
   * <TT>setPackageSeed</TT>. This method only affects the specified stream; the others are not
   * modified. Hence after calling this method, the beginning of the streams will no longer be
   * spaced <SPAN CLASS="MATH"><I>Z</I></SPAN> values apart. For this reason, this method should
   * only be used in very exceptional cases; proper use of the <TT>reset...</TT> methods and of the
   * stream constructor is preferable.
   *
   * @param seed array of 25 elements representing the seed
   */
  public void setSeed(int seed[]) {
    if (seed.length != R) throw new IllegalArgumentException("Seed must contain " + R + "values.");
    boolean goodSeed = false;
    for (int i = 0; i < R; i++) if (seed[i] != 0) goodSeed = true;
    if (!goodSeed)
      throw new IllegalArgumentException("At least one part of the seed" + " must be non-zero.");

    for (int i = 0; i < R; i++) stream[i] = seed[i];
    // stream = polyBase.createElem(seed);
    resetStartStream();
  }
示例#2
0
  /** Constructs a new stream. */
  public GenF2w32() {
    if (!initialised) initialisation();

    // stream = polyBase.createElem();
    // substream = polyBase.createElem();
    stream = new int[R];
    substream = new int[R];
    state = new int[R];

    for (int i = 0; i < R; i++) stream[i] = curr_stream[i];
    // stream.copyFrom(curr_stream);

    advanceSeed(curr_stream, Apz);
    //      curr_stream = curr_stream.multiply(jumpZ);

    resetStartStream();
  }