> For the complete documentation index, see [llms.txt](https://bushuaichen.gitbook.io/ray-papijs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://bushuaichen.gitbook.io/ray-papijs/can-shu.md).

# 参数

在使用变量的时候 我们经常调用一些内容

比如 %javascript\_ray\_10\_500% 让变量返回一个 10\~500 的随机数

那么如何传递参数呢,首先给参数命名 %javascript\_ray\_args\[0]\_args\[1]\_args.....%

请看以下示例&#x20;

```
#file: plugins\PlaceholderAPI\javascripts\main.js


function main() {

    #.length 是 判断长度
    #args.length 是判断有几个参数
    #首先判断 两个参数都有
    if (args.length) == 2{
        var min = args[0];
        var max = args[1];
    #这里是 如果参数 0不为空
    } else if (args.length) == 1{
        var min = args[0];
        var max = 10;
    #如果都是空 就创建一个 1~10的随机数
    } else {
        var min = 1;
        var max = 10;
    }
    #开始随机参数
    var value = Math.floor(Math.random()*(max-min+1)+min);
    
    return value;
}
main();
```

解读:

%javascript\_ray% 1\~10 中的一个随机数

%javascript\_ray\_5% 5\~10 中的一个随机数

%javascript\_ray\_500\_1000% 500\~1000 中的一个随机数


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://bushuaichen.gitbook.io/ray-papijs/can-shu.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
