Skip to content

Latest commit

 

History

History
108 lines (87 loc) · 2.29 KB

README.md

File metadata and controls

108 lines (87 loc) · 2.29 KB

About the "CSharpRandomValue" sample

The "CSharpRandomValue" sample extension provides random numbers between zero and a configurable maximum.

The initial maximum is 1000. New random numbers are returned by the CSharpRandomValue.RandomValue symbol and are always less than CSharpRandomValue.Config::maxRandom.

The extension configuration includes a single integer value (CSharpRandomValue.Config::maxRandom) that can be read directly from the extension configuration.

First steps:

Example requests

  1. Generate a new random number

    Request:

    {
        "requestType": "ReadWrite",
        "commands": [
            {
                "symbol": "CSharpRandomValue.RandomValue",
                "commandOptions": [ "SendErrorMessage" ]
            }
        ]
    }

    Response:

    {
        "commands": [
            {
                "symbol": "CSharpRandomValue.RandomValue",
                "readValue": 32
            }
        ]
    }
  2. Read the value that is currently stored in the extension configuration directly

    Request:

    {
        "requestType": "ReadWrite",
        "commands": [
            {
                "symbol": "CSharpRandomValue.Config::maxRandom",
                "commandOptions": [ "SendErrorMessage" ]
            }
        ]
    }

    Response:

    {
        "commands": [
            {
                "symbol": "CSharpRandomValue.Config::maxRandom",
                "readValue": 10
            }
        ]
    }
  3. Change the value that is stored in the extension configuration

    Request:

    {
        "requestType": "ReadWrite",
        "commands": [
            {
                "symbol": "CSharpRandomValue.Config::maxRandom",
                "writeValue": 2048,
                "commandOptions": [ "SendErrorMessage" ]
            }
        ]
    }

    Response:

    {
        "commands": [
            {
                "symbol": "CSharpRandomValue.Config::maxRandom",
                "readValue": 2048
            }
        ]
    }