SEcure Random GENeraTor

A nice java secure random generator library that supports multiple algorithms

License

License

GroupId

GroupId

com.lindar
ArtifactId

ArtifactId

sergent
Last Version

Last Version

2.1.5
Release Date

Release Date

Type

Type

jar
Description

Description

SEcure Random GENeraTor
A nice java secure random generator library that supports multiple algorithms
Project URL

Project URL

http://www.lindar.com/
Source Code Management

Source Code Management

https://github.com/lindar-open/sergent.git

Download sergent

How to add to project

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

Dependencies

compile (13)

Group / Artifact Type Version
commons-beanutils : commons-beanutils jar 1.9.3
org.apache.commons : commons-configuration2 jar 2.1.1
org.apache.commons : commons-text jar 1.1
org.apache.commons : commons-rng-core jar 1.0
org.apache.commons : commons-rng-client-api jar 1.0
org.apache.commons : commons-rng-simple jar 1.0
org.apache.commons : commons-rng-sampling jar 1.0
log4j : log4j jar 1.2.17
org.slf4j : slf4j-api jar 1.7.21
org.slf4j : slf4j-log4j12 jar 1.7.21
org.springframework : spring-context jar 5.0.0.RELEASE
org.springframework : spring-aop jar 5.0.0.RELEASE
org.aspectj : aspectjweaver jar 1.8.10

test (3)

Group / Artifact Type Version
junit : junit jar 4.12
com.vmlens : concurrent-junit jar 1.0.0
org.assertj : assertj-core jar 3.8.0

Project Modules

There are no modules declared in this project.

SEcure Random GENeraTor java library

Sergent now supports background cycling and external configuration: sergent-configs.properties If you add Sergent as a dependency, all you have to do is create a sergent-configs.properties file in your classpath (preferably under src/main/resources) and set your own random implementation or background cycling configs.

And example configs file can be found here: https://github.com/lindar-open/sergent/blob/master/src/main/resources/sergent-configs-example.properties

Quick Start:

Sergent rng = SergentFactory.newInstance();

// Int Generator
int randInt = rng.intGenerator().randInt();
int randIntWithOptions = rng.intGenerator().withMinAndMax(-10, 10).ignore(Arrays.asList(-9,-8,-7,-6,-5)).randInt();

// Long Generator
long randLong = rng.longGenerator().randLong();
long randLongWithOptions = rng.longGenerator().withMinAndMax(-10, 10).ignore(Arrays.asList(-9,-8,-7,-6,-5)).randLong();

// List Generator
List<Integer> fiveUniqueRandNumbersFromOneToTen = rng.listGenerator().withMinAndMax(1, 10).ofSize(5).unique().randIntegers();
// a unique (no duplicates) random integer list starting from 1 to 90
List<Integer> uniqueSequence = rng.listGenerator().withMinAndMax(1, 90).unique(true).randIntegers();

// String Generator
String alphabeticUppercaseString = rng.stringGenerator().alphabetic().uppercase().randString();
String alphaNumericString = rng.stringGenerator().alphanumeric().randString();
String numericString = rng.stringGenerator().numeric().randString();
String alphaNumericUppercaseOnlyString = rng.stringGenerator().alphanumeric().uppercase().randString();

// List or array Shuffler
List<Integer> numbers = IntStream.rangeClosed(1, 100).boxed().collect(Collectors.toList());
rng.shuffle().list(numbers); // the numbers list is now shuffled randmly
// you can go even further and shuffle only parts of the list by specifying where to start and the direction
rng.shuffle().start(50).towardHead().list(numbers); // will shuffle the numbers from 1 to 50
rng.shuffle().start(50).towardTail().list(numbers); // will shuffle the numbers from 50 to 100

NOTE: All above generators use the same Sergent instance with the same initial configs and seed. If you want to reseed, create a new instance and use that.

For more examples please check the unit tests: https://github.com/lindar-open/sergent/tree/master/src/test/java/com/lindar/sergent

Usage:

<dependency>
    <groupId>com.lindar</groupId>
    <artifactId>sergent</artifactId>
    <version>2.1.5</version>
</dependency>
com.lindar

Lindar Media

All our open-source projects in one place

Versions

Version
2.1.5
2.1.4
2.1.3
2.1.2
2.1.1
2.1.0
2.0.0
1.0.1
1.0.0