In agent development for DeepSeek Harness (DSH), having an Agent generate random content or simulation data is a common requirement. For such scenarios, directly calling low-level libraries in code may not be flexible enough, or difficult to integrate with DSH’s context management. xby-random-number is a DSH plugin maintained by xby-skill, aiming to provide pseudo-random and cryptographically secure random number generation capabilities.
Core Features¶
The plugin provides two types of random number generation capabilities, as well as basic collection operations:
- Standard random numbers: Supports generating integers and floating-point numbers within a specified range.
- Secure random numbers: Provides cryptographically secure token and integer generation.
- Collection operations: Supports shuffling lists, sampling without replacement, and weighted random selection.
- Environment configuration: Provides the
set_xby_apikeymethod for setting an API key and automatically persisting it.
Installation and Activation¶
Use DSH’s command-line tool to install this plugin. After installation, the plugin is automatically persisted and remains available after restarting the process.
dsh plugin --profile web add github:xby_skill/xby-random-number
Typical Usage¶
The plugin exposes methods through DSH’s context. The specific logic of each feature is as follows:
- Random integer:
random_intacceptslowandhighparameters (inclusive bounds) and returns an integer within the range. - Random floating-point number:
random_floatacceptslowandhighparameters (defaults to 0.0 and 1.0) and returns a floating-point number. - Weighted selection:
random_choicesselectskelements frompopulation, supporting theweightsparameter for weighting. - List shuffling:
random_shuffletakes a list and returns a new list with the order shuffled. - Sampling without replacement:
random_sampleselectskunique elements frompopulation. - Secure token:
secure_token_hexgenerates 32 random bytes by default and returns a hexadecimal string. - Secure integer:
secure_random_intgenerates a cryptographically secure random integer less thanupper_bound.
Configuration and Considerations¶
- API key: Before use, you must register on the Xiaobenyang official website and obtain an API key.
- Environment: The plugin type is
module, and its dependent files includedistandcordis.patch.yml. - Permissions: The plugin runs with the permissions of the current DSH process. Before installation, it is recommended to review the source code to ensure compliance with security policies.
Summary¶
xby-random-number provides basic random number generation capabilities for DSH, covering from standard mathematical randomness to cryptographically secure token generation. For developers who need to dynamically generate data or simulate scenarios, this is a lightweight solution.
- Source code: https://github.com/xby-skill/xby-random-number
- Plugin directory page: https://www.skillhub.cn/plugins/xby-skill/xby-random-number