Skip to main content


Random runtime

The Random runtime allows you to produce structured datas randomly.

One use case is to use this runtime as way of testing, for example you can rapidly draft a small backend that produces structured data for your frontend application.

The seed parameter ensures repeatability if set.


Another use case is to inject random values to a function input



Here is a list of some standard generators that you can attach to your type, if unspecifed, it will default on generating any values that the associated type can hold.

TypeGenerator config
t.string()name, address, postcode, country, email, uuid, uri, hostname, date, time, phone, ean
t.integer(), t.float()age
const user = t.struct(
id: t.uuid(), // random uuid
name: t.string({}, { config: { gen: "name" } }), // random name
age: t.integer({}, { config: { gen: "age", type: "adult" } }), // type: "child", "adult"
address: t.struct(
street: t.string({}, { config: { gen: "address" } }),
city: t.string({}, { config: { gen: "city" } }),
postcode: t.string({}, { config: { gen: "postcode"} }),
country: t.string({}, { config: { gen: "country", full: true } }),