> ## Documentation Index
> Fetch the complete documentation index at: https://docs.kinetica.com/llms.txt
> Use this file to discover all available pages before exploring further.

# /insert/records/random

```
URL: http://<db.host>:<db.port>/insert/records/random
```

Generates a specified number of random records and adds them to the given
table. There is an optional parameter that allows the user to customize the
ranges of the column values. It also allows the user to specify linear profiles
for some or all columns in which case linear values are generated rather than
random ones. Only individual tables are supported for this operation.

This operation is synchronous, meaning that a response will not be returned
until all random records are fully available.

## Input Parameter Description

<ParamField body="table_name" type="string">
  Table to which random records will be added, in \[schema\_name.]table\_name format, using standard [name resolution rules](../../concepts/tables/#table-name-resolution). Must be an existing table, not a view.
</ParamField>

<ParamField body="count" type="long">
  Number of records to generate.
</ParamField>

<ParamField body="options" type="map of string to maps of string to doubles">
  Optional parameter to pass in specifications for the randomness of the values.  This map is different from the *options* parameter of most other endpoints in that it is a map of string to map of string to doubles, while most others are maps of string to string.  In this map, the top level keys represent which column's parameters are being specified, while the internal keys represents which parameter is being specified. These parameters take on different meanings depending on the type of the column.

  The default value is an empty map ( \{} ).

  <Expandable title="options">
    <ParamField body="seed">
      If provided, the internal random number generator will be initialized with the given value.  The minimum is 0.  This allows for the same set of random numbers to be generated across invocation of this endpoint in case the user wants to repeat the test.  Since input parameter *options*, is a map of maps, we need an internal map to provide the seed value.  For example, to pass 100 as the seed value through this parameter, you need something equivalent to: 'options' = \{'seed': \{ 'value': 100 } }.

      <Expandable title="seed">
        <ParamField body="value">
          The seed value to use.
        </ParamField>
      </Expandable>
    </ParamField>

    <ParamField body="all">
      This key indicates that the specifications relayed in the internal map are to be applied to all columns of the records.

      <Expandable title="all">
        <ParamField body="min">
          For numerical columns, the minimum of the generated values is set to this value.  Default is -99999.  For point, shape, and track columns, min for numeric 'x' and 'y' columns needs to be within \[-180, 180] and \[-90, 90], respectively. The default minimum possible values for these columns in such cases are -180.0 and -90.0. For the 'TIMESTAMP' column, the default minimum corresponds to Jan 1, 2010.

          For string columns, the minimum length of the randomly generated strings is set to this value (default is 0). If both minimum and maximum are provided, minimum must be less than or equal to max.

          If the min is outside the accepted ranges for strings columns and 'x' and 'y' columns for point/shape/track, then those parameters will not be set; however, an error will not be thrown in such a case. It is the responsibility of the user to use the *all* parameter judiciously.
        </ParamField>

        <ParamField body="max">
          For numerical columns, the maximum of the generated values is set to this value. Default is 99999. For point, shape, and track columns, max for numeric 'x' and 'y' columns needs to be within \[-180, 180] and \[-90, 90], respectively. The default minimum possible values for these columns in such cases are 180.0 and 90.0.

          For string columns, the maximum length of the randomly generated strings. If both minimum and maximum are provided, *max* must be greater than or equal to *min*.

          If the *max* is outside the accepted ranges for strings columns and 'x' and 'y' columns for point/shape/track, then those parameters will not be set; however, an error will not be thrown in such a case. It is the responsibility of the user to use the *all* parameter judiciously.
        </ParamField>

        <ParamField body="interval">
          If specified, generate values for all columns evenly spaced with the given interval value. If a max value is specified for a given column the data is randomly generated between min and max and decimated down to the interval. If no max is provided the data is linearly generated starting at the minimum value (instead of generating random data). For non-decimated string-type columns the interval value is ignored. Instead the values are generated following the pattern: 'attrname\_creationIndex#', i.e. the column name suffixed with an underscore and a running counter (starting at 0). For string types with limited size (e.g. char4) the prefix is dropped. No nulls will be generated for nullable columns.
        </ParamField>

        <ParamField body="null_percentage">
          If specified, then generate the given percentage of the count as nulls for all nullable columns. This option will be ignored for non-nullable columns.  The value must be within the range \[0, 1.0].  The default value is 5% (0.05).
        </ParamField>

        <ParamField body="cardinality">
          If specified, limit the randomly generated values to a fixed set. Not allowed on a column with interval specified, and is not applicable to WKT or Track-specific columns. The value must be greater than 0. This option is disabled by default.
        </ParamField>
      </Expandable>
    </ParamField>

    <ParamField body="attr_name">
      Use the desired column name in place of *attr\_name*, and set the following parameters for the column specified. This overrides any parameter set by *all*.

      <Expandable title="attr_name">
        <ParamField body="min">
          For numerical columns, the minimum of the generated values is set to this value.  Default is -99999.  For point, shape, and track columns, min for numeric 'x' and 'y' columns needs to be within \[-180, 180] and \[-90, 90], respectively. The default minimum possible values for these columns in such cases are -180.0 and -90.0. For the 'TIMESTAMP' column, the default minimum corresponds to Jan 1, 2010.

          For string columns, the minimum length of the randomly generated strings is set to this value (default is 0). If both minimum and maximum are provided, minimum must be less than or equal to max.

          If the min is outside the accepted ranges for strings columns and 'x' and 'y' columns for point/shape/track, then those parameters will not be set; however, an error will not be thrown in such a case. It is the responsibility of the user to use the *all* parameter judiciously.
        </ParamField>

        <ParamField body="max">
          For numerical columns, the maximum of the generated values is set to this value. Default is 99999. For point, shape, and track columns, max for numeric 'x' and 'y' columns needs to be within \[-180, 180] and \[-90, 90], respectively. The default minimum possible values for these columns in such cases are 180.0 and 90.0.

          For string columns, the maximum length of the randomly generated strings. If both minimum and maximum are provided, *max* must be greater than or equal to *min*.

          If the *max* is outside the accepted ranges for strings columns and 'x' and 'y' columns for point/shape/track, then those parameters will not be set; however, an error will not be thrown in such a case. It is the responsibility of the user to use the *all* parameter judiciously.
        </ParamField>

        <ParamField body="interval">
          If specified, generate values for all columns evenly spaced with the given interval value. If a max value is specified for a given column the data is randomly generated between min and max and decimated down to the interval. If no max is provided the data is linearly generated starting at the minimum value (instead of generating random data). For non-decimated string-type columns the interval value is ignored. Instead the values are generated following the pattern: 'attrname\_creationIndex#', i.e. the column name suffixed with an underscore and a running counter (starting at 0). For string types with limited size (e.g. char4) the prefix is dropped. No nulls will be generated for nullable columns.
        </ParamField>

        <ParamField body="null_percentage">
          If specified and if this column is nullable, then generate the given percentage of the count as nulls.  This option will result in an error if the column is not nullable.  The value must be within the range \[0, 1.0].  The default value is 5% (0.05).
        </ParamField>

        <ParamField body="cardinality">
          If specified, limit the randomly generated values to a fixed set. Not allowed on a column with interval specified, and is not applicable to WKT or Track-specific columns. The value must be greater than 0. This option is disabled by default.
        </ParamField>
      </Expandable>
    </ParamField>

    <ParamField body="track_length">
      This key-map pair is only valid for track data sets (an error is thrown otherwise).  No nulls would be generated for nullable columns.

      <Expandable title="track_length">
        <ParamField body="min">
          Minimum possible length for generated series; default is 100 records per series. Must be an integral value within the range \[1, 500]. If both min and max are specified, min must be less than or equal to max.
        </ParamField>

        <ParamField body="max">
          Maximum possible length for generated series; default is 500 records per series. Must be an integral value within the range \[1, 500]. If both min and max are specified, max must be greater than or equal to min.
        </ParamField>
      </Expandable>
    </ParamField>
  </Expandable>
</ParamField>

## Output Parameter Description

The Kinetica server embeds the endpoint response inside a standard response structure which contains status information and the actual response to the query.  Here is a description of the various fields of the wrapper:

<ResponseField name="status" type="String">
  'OK' or 'ERROR'
</ResponseField>

<ResponseField name="message" type="String">
  Empty if success or an error message
</ResponseField>

<ResponseField name="data_type" type="String">
  'insert\_records\_random\_response' or 'none' in case of an error
</ResponseField>

<ResponseField name="data" type="String">
  Empty string
</ResponseField>

<ResponseField name="data_str" type="JSON or String">
  This embedded JSON represents the result of the /insert/records/random endpoint:

  <Expandable title="data_str">
    <ResponseField name="table_name" type="string">
      Value of input parameter *table\_name*.
    </ResponseField>

    <ResponseField name="count" type="long">
      Number of records inserted.
    </ResponseField>

    <ResponseField name="info" type="map of string to strings">
      Additional information.
    </ResponseField>
  </Expandable>

  Empty string in case of an error.
</ResponseField>
