## Random Values

Random Integer

new Random().nextInt(min, max+1) return [min, max]

Math.random() return [0, 1)

Random.nextInt(n) is more efficient than Math.random() * n

Math.random() uses Random.nextDouble() internally. Random.nextDouble() uses Random.next() twice to generate a double that has approximately uniformly distributed bits in its mantissa, so it is uniformly distributed in the range 0 to 1-(2^-53).

Random.nextInt(n) uses Random.next() less than twice on average- it uses it once, and if the value obtained is above the highest multiple of n below MAX_INT it tries again, otherwise is returns the value modulo n (this prevents the values above the highest multiple of n below MAX_INT skewing the distribution), so returning a value which is uniformly distributed in the range 0 to n-1.

Random float

// TODO

Random String

// TODO

## Regex Expression

Get Match String

Replace group string

Non-greedy regular expression

Followed by the ?. For example .*?

Match special characters

For example:

Match multiple line string

Match case-insensitive string