haistudio/predictable-random
Composer 安装命令:
composer require haistudio/predictable-random
包简介
Generates a predictable random number based on a starting seed.
README 文档
README
Generates a predictable random number (or item in an array) based on a starting seed. For when you want things to seem random, but not really be random.
Requirements
This plugin requires Craft CMS 3.0.0-beta.23 or later.
Installation
To install the plugin, follow these instructions.
-
Open your terminal and go to your Craft project:
cd /path/to/project -
Then tell Composer to load the plugin:
composer require haistudio/predictable-random -
In the Control Panel, go to Settings → Plugins and click the “Install” button for Predictable Random.
Configuring Predictable Random
Set a seed with:
{% do setPredictableRandomSeed(666) %}
Get current seed value with:
{% do getPredictableRandomSeed() %}
Get a random number within a range:
{% set number = predictableRandom(min, max) %}
Or get a random value from an array of possible values:
{% set number = predictableRandom([0,2,4,8,16,'bad','code']) %}
Predictable Random Roadmap
None whatsoever.
统计信息
- 总下载量: 24
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-09-02