Fast random

Java API to quickly extract random values from a source array.

License

License

GroupId

GroupId

com.github.cbismuth
ArtifactId

ArtifactId

fast-random
Last Version

Last Version

1.1.0
Release Date

Release Date

Type

Type

jar
Description

Description

Fast random
Java API to quickly extract random values from a source array.
Project URL

Project URL

https://github.com/cbismuth/fast-random
Source Code Management

Source Code Management

https://github.com/cbismuth/fast-random

Download fast-random

How to add to project

<!-- https://jarcasting.com/artifacts/com.github.cbismuth/fast-random/ -->
<dependency>
    <groupId>com.github.cbismuth</groupId>
    <artifactId>fast-random</artifactId>
    <version>1.1.0</version>
</dependency>
// https://jarcasting.com/artifacts/com.github.cbismuth/fast-random/
implementation 'com.github.cbismuth:fast-random:1.1.0'
// https://jarcasting.com/artifacts/com.github.cbismuth/fast-random/
implementation ("com.github.cbismuth:fast-random:1.1.0")
'com.github.cbismuth:fast-random:jar:1.1.0'
<dependency org="com.github.cbismuth" name="fast-random" rev="1.1.0">
  <artifact name="fast-random" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.github.cbismuth', module='fast-random', version='1.1.0')
)
libraryDependencies += "com.github.cbismuth" % "fast-random" % "1.1.0"
[com.github.cbismuth/fast-random "1.1.0"]

Dependencies

compile (3)

Group / Artifact Type Version
org.apache.commons : commons-lang3 jar 3.4
com.google.guava : guava jar 19.0
org.slf4j : slf4j-api jar 1.7.21

runtime (2)

Group / Artifact Type Version
ch.qos.logback : logback-classic jar 1.1.7
org.fusesource.jansi : jansi jar 1.13

test (1)

Group / Artifact Type Version
junit : junit jar 4.12

Project Modules

There are no modules declared in this project.

Random Utils

build coverage javadoc repository issues licence

This repository contains an API to quickly extract random values from a source array.

This API aims to be scalable (i.e. does not depend on source array size), fair and returns a random array without duplicate.

Metrics

Expectations

  • a source array of 1 000 000 elements
  • a random sub-array of 100 000 elements

Elapsed time

  • noob version (filter input array with split and join) ≈ 4 minutes
  • smart version (in-place push back picked up elements) ≈ 25 seconds
  • smarter version (in-place push back picked up elements and hash-based duplicates detection) ≈ 40 milliseconds

Versions

Version
1.1.0