public final class Draw extends Object
Copyright (c) 2013-2018 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.
Modifier and Type | Method and Description |
---|---|
static <E> E |
draw(Collection<E> collection,
StreamInterface stream)
Returns a randomly drawn element using uniform weights.
|
static <E> E |
drawWeighted(Map<E,? extends Double> map,
StreamInterface stream)
Returns a randomly drawn element using draw weights.
|
public static <E> E drawWeighted(Map<E,? extends Double> map, StreamInterface stream)
E
- element typemap
- Map<E, Double>; map of elements and respective weightsstream
- StreamInterface; random number streampublic static <E> E draw(Collection<E> collection, StreamInterface stream)
E
- element typecollection
- Collection<E>; collection of elementsstream
- StreamInterface; random number streamCopyright © 2014–2018 Delft University of Technology. All rights reserved.