Construct a new Intersection target on the java heap.

@param seed <a href="{@docRoot}/resources/dictionary.html#seed">See Seed</a>
@return a new IntersectionImpl on the Java heap
771831
static IntersectionImpl initNewHeapInstance(final long seed) {
    final IntersectionImpl impl = new IntersectionImpl(null, seed, false);
    impl.lgArrLongs_ = 0;
    impl.curCount_ = -1;  //Universal Set is true
    impl.thetaLong_ = Long.MAX_VALUE;
    impl.empty_ = false;  //A virgin intersection represents the Universal Set so empty is FALSE!
    impl.hashTable_ = null;
    return impl;
  }
73620
@XmlElementDecl(namespace = "http://www.w3.org/1998/Math/MathML", name = "intersect")
    public JAXBElement<IntersectType> createIntersect(IntersectType value) {
        return new JAXBElement<IntersectType>(_Intersect_QNAME, IntersectType.class, null, value);
    }
410825
@Override
    public Set<IPersonAttributes> getPeopleWithMultivaluedAttributes(final Map<String, List<Object>> seed,
                                                                     final IPersonAttributeDaoFilter filter) {
        Validate.notNull(seed, "Argument 'seed' cannot be null.");

        if (patterns == null || patterns.size() < 1) {
            throw new IllegalStateException("patterns Map may not be null and must contain at least 1 mapping.");
        }
        if (targetPersonAttributeDao == null) {
            throw new IllegalStateException("targetPersonAttributeDao may not be null");
        }

        //Flag for patterns that match
        boolean matchedPatterns = false;

        //Iterate through all attributeName/pattern pairs
        for (final Map.Entry<String, Pattern> patternEntry : this.patterns.entrySet()) {
            final String attributeName = patternEntry.getKey();
            final List<Object> attributeValues = seed.get(attributeName);

            //Check if the value exists
            if (attributeValues == null) {
                if (this.matchAllPatterns) {
                    //Need to match ALL patters, if the attribute isn't in the seed it can't be matched, return null
                    if (this.logger.isInfoEnabled()) {
                        this.logger.info("All patterns must match and attribute='" + attributeName + "' does not exist in the seed, returning null.");
                    }

                    return null;
                }

                //Don't need to match all, just go to the next attribute and see if it exists
                continue;
            }

            //The pattern to test the attribute's value(s) with
            final Pattern compiledPattern = patternEntry.getValue();
            if (compiledPattern == null) {
                throw new IllegalStateException("Attribute '" + attributeName + "' has a null pattern");
            }

            //Flag for matching the pattern on the values
            boolean matchedValues = false;

            //Iterate over the values for the attribute, testing each against the pattern
            for (final Object valueObj : attributeValues) {
                final String value;
                try {
                    value = (String) valueObj;
                } catch (final ClassCastException cce) {
                    final IllegalArgumentException iae = new IllegalArgumentException("RegexGatewayPersonAttributeDao can only accept seeds who's values are String or List of String. Attribute '" + attributeName + "' has a non-String value.");
                    iae.initCause(cce);
                    throw iae;
                }

                //Check if the value matches the pattern
                final Matcher valueMatcher = compiledPattern.matcher(value);
                matchedValues = valueMatcher.matches();

                //Only one value needs to be matched, this one matched so no need to test the rest, break out of the loop
                if (matchedValues && !this.matchAllValues) {
                    if (this.logger.isDebugEnabled()) {
                        this.logger.debug("value='" + value + "' matched pattern='" + compiledPattern + "' and only one value match is needed, leaving value matching loop.");
                    }

                    break;
                }
                //Need to match all values, this one failed so no need to test the rest, break out of the loop
                else if (!matchedValues && this.matchAllValues) {
                    if (this.logger.isDebugEnabled()) {
                        this.logger.debug("value='" + value + "' did not match pattern='" + compiledPattern + "' and all values need to match, leaving value matching loop.");
                    }

                    break;
                }
                //Extra logging
                else if (this.logger.isDebugEnabled()) {
                    if (matchedValues) {
                        this.logger.debug("value='" + value + "' matched pattern='" + compiledPattern + "' and all values need to match, continuing value matching loop.");
                    } else {
                        this.logger.debug("value='" + value + "' did not match pattern='" + compiledPattern + "' and only one value match is needed, continuing value matching loop.");
                    }
                }
            }

            matchedPatterns = matchedValues;

            //Only one pattern needs to be matched, this one matched so no need to test the rest, break out of the loop
            if (matchedPatterns && !this.matchAllPatterns) {
                if (this.logger.isDebugEnabled()) {
                    this.logger.debug("pattern='" + compiledPattern + "' found a match and only one pattern match is needed, leaving pattern matching loop.");
                }

                break;
            }
            //Need to match all patterns, this one failed so no need to test the rest, break out of the loop
            else if (!matchedPatterns && this.matchAllPatterns) {
                if (this.logger.isDebugEnabled()) {
                    this.logger.debug("pattern='" + compiledPattern + "' did not find a match and all patterns need to match, leaving pattern matching loop.");
                }

                break;
            }
            //Extra logging
            else if (this.logger.isDebugEnabled()) {
                if (matchedPatterns) {
                    this.logger.debug("pattern='" + compiledPattern + "' found a match and all patterns need to match, continuing pattern matching loop.");
                } else {
                    this.logger.debug("pattern='" + compiledPattern + "' did not find a match and only one pattern match is needed, continuing pattern matching loop.");
                }
            }
        }

        //Execute the wrapped DAO if the match criteria was met
        if (matchedPatterns) {
            if (this.logger.isInfoEnabled()) {
                this.logger.info("Matching criteria '" + this.patterns + "' was met for query '" + seed + "', delegating call to the targetPersonAttributeDao='" + this.targetPersonAttributeDao + "'");
            }

            return this.targetPersonAttributeDao.getPeopleWithMultivaluedAttributes(seed, filter);
        }

        if (this.logger.isInfoEnabled()) {
            this.logger.info("Matching criteria '" + this.patterns + "' was not met for query '" + seed + "', return null");
        }

        return null;
    }
899190
public static CpcSketch heapify(final Memory mem, final long seed) {
    final CompressedState state = CompressedState.importFromMemory(mem);
    return uncompress(state, seed);
  }
576821
function seedrand(seed) {
    for (var i = 0; i < randseed.length; i++) {
      randseed[i] = 0;
    }
    for (var i = 0; i < seed.length; i++) {
      randseed[i%4] = ((randseed[i%4] << 5) - randseed[i%4]) + seed.charCodeAt(i);
    }
  }
446753
public static Random getRNG(long... seed) {
    switch(_rngType) {
    case JavaRNG:      return new H2ORandomRNG(seed[0]);
    case XorShiftRNG:  return new XorShiftRNG (seed[0]);
    case PCGRNG:       return new PCGRNG      (seed[0],seed.length > 1 ? seed[1] : 1);
    case MersenneTwisterRNG:
      // Do not copy the seeds - use them, and initialize the first two ints by
      // seeds based given argument.  The call is locked, and also
      // MersenneTwisterRNG will just copy the seeds into its datastructures
      return new MersenneTwisterRNG(ArrayUtils.unpackInts(seed));
    }
    throw H2O.fail();
  }
965346
public Range intersect(final Range outerRange) throws RangeException {
		if (min > outerRange.max) {
			throw new IllegalArgumentException("range maximum must be greater or equal than " + min);
		}
		if (max < outerRange.min) {
			throw new IllegalArgumentException("range minimum must be less or equal than " + max);
		}
		int newMin = Math.max(min, outerRange.min);
		int newMax = Math.min(max, outerRange.max);
		return new Range(newMin, newMax);
	}
201406
public Range intersection(final Range range) {
		int c0 = Math.max(this.start, range.start);
		int c1 = Math.min(this.end, range.end);
		return c0 <= c1 ? new Range(c0, c1) : null;
	}
614397
@SuppressWarnings("unchecked")
    public static <V> DenseGrid<V> create(Grid<? extends V> grid) {
        if (grid == null) {
            throw new IllegalArgumentException("Grid must not be null");
        }
        if (grid instanceof DenseImmutableGrid) {
            return new DenseGrid<V>((DenseImmutableGrid<V>) grid);
        }
        DenseGrid<V> created = DenseGrid.create(grid.rowCount(), grid.columnCount());
        created.putAll(grid);
        return created;
    }
238810
public static CipherUtil buildInstance(Algorithms algorithms, String seed) {
        int keySize = 0;
        if (algorithms == Algorithms.AES) {
            keySize = 128;
        } else if (algorithms == Algorithms.DES) {
            keySize = 56;
        }
        return buildInstance(algorithms, seed, keySize);
    }
482315
private final void setSeed(int seed) {

		// Annoying runtime check for initialisation of internal data
		// caused by java.util.Random invoking setSeed() during init.
		// This is unavoidable because no fields in our instance will
		// have been initialised at this point, not even if the code
		// were placed at the declaration of the member variable.
		if (mt == null) mt = new int[N];

		// ---- Begin Mersenne Twister Algorithm ----
		mt[0] = seed;
		for (mti = 1; mti < N; mti++) {
			mt[mti] = (MAGIC_FACTOR1 * (mt[mti-1] ^ (mt[mti-1] >>> 30)) + mti);
		}
		// ---- End Mersenne Twister Algorithm ----
	}
216854
public void shuffle(long seed) {
        // just skip shuffle if there's only 1 example
        if (numExamples() < 2)
            return;

        //note here we use the same seed with different random objects guaranteeing same order

        List<INDArray> arrays = new ArrayList<>();
        List<int[]> dimensions = new ArrayList<>();

        arrays.add(getFeatures());
        dimensions.add(ArrayUtil.range(1, getFeatures().rank()));

        arrays.add(getLabels());
        dimensions.add(ArrayUtil.range(1, getLabels().rank()));

        if (featuresMask != null) {
            arrays.add(getFeaturesMaskArray());
            dimensions.add(ArrayUtil.range(1, getFeaturesMaskArray().rank()));
        }

        if (labelsMask != null) {
            arrays.add(getLabelsMaskArray());
            dimensions.add(ArrayUtil.range(1, getLabelsMaskArray().rank()));
        }

        Nd4j.shuffle(arrays, new Random(seed), dimensions);

        //As per CpuNDArrayFactory.shuffle(List<INDArray> arrays, Random rnd, List<int[]> dimensions) and libnd4j transforms.h shuffleKernelGeneric
        if (exampleMetaData != null) {
            int[] map = ArrayUtil.buildInterleavedVector(new Random(seed), numExamples());
            ArrayUtil.shuffleWithMap(exampleMetaData, map);
        }
    }
99412
public static Collision createCollision(XmlReader node)
    {
        Check.notNull(node);

        final String name = node.readString(ATT_NAME);
        final int offsetX = node.readInteger(ATT_OFFSETX);
        final int offsetY = node.readInteger(ATT_OFFSETY);
        final int width = node.readInteger(ATT_WIDTH);
        final int height = node.readInteger(ATT_HEIGHT);
        final boolean mirror = node.readBoolean(ATT_MIRROR);

        return new Collision(name, offsetX, offsetY, width, height, mirror);
    }
152780
private void addSeed(SiteNode node) {
		try {
			if (!node.isRoot() && node.getHistoryReference() != null) {
				HttpMessage msg = node.getHistoryReference().getHttpMessage();
				if (!msg.getResponseHeader().isImage()) {
					spider.addSeed(msg);
				}
			}
		} catch (Exception e) {
			log.error("Error while adding seed for Spider scan: " + e.getMessage(), e);
		}
	}
1297333
static SquareNode findSeedNode(List<SquareNode> cluster) {
		SquareNode seed = null;

		for (int i = 0; i < cluster.size(); i++) {
			SquareNode n = cluster.get(i);
			int numConnections = n.getNumberOfConnections();
			if( numConnections == 0 || numConnections > 2 )
				continue;
			seed = n;
			break;
		}
		return seed;
	}
350629
public void setWebSeeds(List<WebSeedEntry> seeds) {
        web_seed_entry_vector v = new web_seed_entry_vector();

        for (WebSeedEntry e : seeds) {
            v.push_back(e.swig());
        }

        ti.set_web_seeds(v);
    }
977072
public static CpcSketch heapify(final byte[] byteArray, final long seed) {
    final Memory mem = Memory.wrap(byteArray);
    return heapify(mem, seed);
  }