AtomicArray
implements a fixed-length indexed sequence where reads and
writes have volatile semantics.
An clonable unsynchronized random number generator that uses the same
algorithm as the concurrent object SimpleRandom
.
An clonable unsynchronized random number generator that uses the same
algorithm as the concurrent object SimpleRandom
. The caller must ensure
that each SimpleRandom
instance is used from only one thread at a time.
A random number generator that focuses on speed and lack of inter-thread interference, rather than on the quality of the numbers returned.
A random number generator that focuses on speed and lack of inter-thread
interference, rather than on the quality of the numbers returned. The
object SimpleRandom
is striped internally to reduce
contention when accessed from multiple threads. The class
SimpleRandom
should only be used by a single thread.
The constants in this 64-bit linear congruential random number generator are from http://nuclear.llnl.gov/CNP/rng/rngman/node4.html.
AtomicArray
implements a fixed-length indexed sequence where reads and writes have volatile semantics. In addition, it adds an atomic swap operation (swap
) and an atomic compare-and-swap (compareAndSet
). The collection is backed by one of the Java atomic array classes, with the best match chosen at construction time using a manifest.Instances of
AtomicArray[T]
are backed byAtomicIntegerArray
ifT
is a primitive of at most 32 bits (smaller values are padded rather than packed).AtomicArray[Long]
andAtomicArray[Double]
are backed byAtomicLongArray
. All other instances ofAtomicArray[T]
are backed byAtomicReferenceArray
(except forAtomicArray[Unit]
). Floats and doubles are stored using their raw bit representation.This class is used in the implementation of the reference STM implementation, but it is standalone and may be generally useful.