承接 endroid/priority-shuffle-random 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

endroid/priority-shuffle-random

最新稳定版本:2.0.3

Composer 安装命令:

composer require endroid/priority-shuffle-random

包简介

Endroid Priority Shuffle Random

README 文档

README

By endroid

Latest Stable Version Build Status Total Downloads Monthly Downloads License

This library extends the basic random functionality by ensuring that the appearance of items is evenly distributed while respecting their priority. Items with priority 3 will be shown three times as often as items with priority 1, while the shuffle algorithm ensures that the values are spreaded nicely.

Installation

Use Composer to install the library.

$ composer require endroid/priority-shuffle-random

Usage

<?php

use Endroid\PriorityShuffleRandom;

$random = new PriorityShuffleRandom();
$random->add('A', 1);
$random->add('B', 2); // Show B two times as often as the other items
$random->add('C', 1);
$random->add('D', 1);

for ($i = 0; $i < 12; $i++) {
    echo $random->next();
}

// Example output: CABDBDBACBAC

Versioning

Version numbers follow the MAJOR.MINOR.PATCH scheme. Backwards compatibility breaking changes will be kept to a minimum but be aware that these can occur. Lock your dependencies for production and test your code when upgrading.

License

This bundle is under the MIT license. For the full copyright and license information please view the LICENSE file that was distributed with this source code.

统计信息

  • 总下载量: 1.69k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-10-11