承接 antikirra/array-shuffle 相关项目开发

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

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

antikirra/array-shuffle

最新稳定版本:1.0.0

Composer 安装命令:

composer require antikirra/array-shuffle

包简介

README 文档

README

Using a numerical representation of anything (whether it's a client's IP address, a date in the format YYYYMMDD, or a unique user identifier), you can generate a deterministic array of data sorted in a pseudorandom manner. This can be useful for implementing both business tasks and writing tests.

Be cautious when using associative arrays, deeply nested arrays, or arrays containing objects. The implementation of this library does not guarantee predictable results in all of the mentioned cases. Special attention is given to simplicity of implementation and data processing speed.

Install

composer require antikirra/array-shuffle

Basic usage

<?php

require __DIR__ . '/vendor/autoload.php';

// only if the function has not been defined in the global scope
array_shuffle($array, 100500);

// if the function could not be defined globally
\Antikirra\array_shuffle($array, 100500);

// under the hood
\Antikirra\ArrayShuffle\ArrayShuffle::shuffle($array, 100500);

Demo

<?php

require __DIR__ . '/vendor/autoload.php';

$array = [0, 2, 6, 1, 8, 9, 5, 4, 3, 7];

$seed = 100500;

$array1 = array_shuffle($array, $seed);

print_r($array1); // [1, 2, 4, 7, 8, 6, 5, 3, 9, 0]

$array2 = $array1;

for ($i = 0; $i < $seed; $i++) {
    shuffle($array2);
}

$array3 = array_shuffle($array2, $seed);

print_r($array3); // [1, 2, 4, 7, 8, 6, 5, 3, 9, 0]

var_dump($array1 === $array3); // true

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-05-24

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固