# Random Source

he source will generate random inputs with a specified pattern.

## Compile & deploy plugin

```shell
# cd $kuiper_src
# go build --buildmode=plugin -o plugins/sources/Random.so plugins/sources/random.go
# cp plugins/sources/Random.so $kuiper_install/plugins/sources
```

Restart the Kuiper server to activate the plugin.

## Configuration

The configuration for this source is ``$kuiper/etc/sources/random.yaml``. The format is as below:

```yaml
default:
  interval: 1000
  pattern:
    count: 50

ext:
  interval: 300
  seed: 1
```
### Global configurations

Use can specify the global random source settings here. The configuration items specified in ``default`` section will be taken as default settings for the source when running this source.

### interval

The interval (ms) to issue a message.

### seed

The maximum integer to be produced by the random function

### pattern

The pattern to be generated by the source. In the above example, the pattern will be a json like {"count":50}

## Override the default settings

If you have a specific connection that need to overwrite the default settings, you can create a customized section. In the previous sample, we create a specific setting named with ``test``.  Then you can specify the configuration with option ``CONF_KEY`` when creating the stream definition (see [stream specs](../../sqls/streams.md) for more info).

## Sample usage

```
demo (
		...
	) WITH (DATASOURCE="demo", FORMAT="JSON", CONF_KEY="ext", TYPE="random");
```

The configuration keys "ext" will be used.

