Skip to content


The simplest way to use Datafaker to generate fake data is by instantiating the Faker using the default constructor.

Default usage

import net.datafaker.Faker;

Faker faker = new Faker();

String name =; // Miss Samanta Schmidt
import net.datafaker.Faker

val faker = Faker()

val name = // Miss Samanta Schmidt

This will instantiate a Faker using the English locale.

Different locale

To use Datafaker with a different locale, you can supply on in the constructor as such:

Faker faker = new Faker(new Locale("nl"));

String name =; // Chelan Klijnsma
val faker = Faker(Locale("nl"))

val name = // Chelan Klijnsma

Repeatable random results

To generate a more predictable random result, it's possible to provide a seed value to the Faker.

When providing a seed, the instantiatiton of Fake objects will always happen in a predictable way, which can be handy for generating results multiple times.

Faker faker = new Faker(new Random(0));
val faker = new Faker(Random(0))
Back to top