[API reference](https://evolu.dev/docs/api-reference) › [@evolu/common](https://evolu.dev/docs/api-reference/common) › [Random](https://evolu.dev/docs/api-reference/common/Random) › Random

Defined in: [packages/common/src/Random.ts:47](https://github.com/evoluhq/evolu/blob/037c390af081e9944d616ff298a729515c5c5ab7/packages/common/src/Random.ts#L47)

A simple wrapper around Math.random().

For more complex needs check [RandomLibDep](https://evolu.dev/docs/api-reference/common/Random/interfaces/RandomLibDep).

### Example

```ts
import {
  assertEqual,
  assertTrue,
  assertType,
  createRandom,
  testCreateRandom,
  type RandomNumber,
} from "@evolu/common";

// For apps, use the Math.random-backed implementation.
const random = createRandom();
const value = random.next();
assertType<RandomNumber, typeof value>();
assertTrue(value >= 0);
assertTrue(value < 1);

// For tests, use a seed.
const firstTestRandom = testCreateRandom("test");
const secondTestRandom = testCreateRandom("test");
assertEqual(firstTestRandom.next(), secondTestRandom.next());
```

## Properties

<a id="next"></a>

### next

```ts
readonly next: () => RandomNumber;
```

Defined in: [packages/common/src/Random.ts:49](https://github.com/evoluhq/evolu/blob/037c390af081e9944d616ff298a729515c5c5ab7/packages/common/src/Random.ts#L49)

Returns a floating point number in [0, 1). Just like Math.random().