Queries Library
Queries LibraryCreate a thousand random strings

Create a thousand random strings

This query produces an array with 1000 random strings.

You can customize the output via variables:

  • $numberCodes: How many strings to produce (1000 by default)
  • $codeLength: The length of each string (16 by default)
  • $characters: What characters to include in the random string (ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 by default)
query CreateRandomStrings(
  $numberCodes: Int! = 1000,
  $codeLength: Int! = 16,
  $characters: String! = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
) {
  randomStrings: _arrayPad(array: [], length: $numberCodes, value: null)
    @underEachArrayItem
      @applyField(
        name: "_generateRandomString",
        arguments: {
          length: $codeLength,
          characters: $characters,
        },
        setResultInResponse: true
      )
}