当前位置:网站首页>【oops-framework】随机数生成管理
【oops-framework】随机数生成管理
2022-07-26 00:27:00 【dgflash_game】
功能说明
OopsFramework-随机数生成管理模块,封装了seedrandom 第三方随机数据库
使用说明
设置随机种子
// 随机种子可由服务端派发给其它客户端,同样的种子,多端随机同样次数时,结果是相同的
RandomManager.instance.setSeed(123456789);
生成指定范围的随机整数
var min = 1;
var max = 10;
// [min,max) 得到一个两数之间的随机整数,这个值不小于min(如果min不是整数的话,得到一个向上取整的 min),并且小于(但不等于)max
RandomManager.instance.getRandomInt(min, max, 1);
// [min,max] 得到一个两数之间的随机整数,包括两个数在内,这个值比min大(如果min不是整数,那就不小于比min大的整数),但小于(但不等于)max
RandomManager.instance.getRandomInt(min, max, 2);
// (min,max) 得到一个两数之间的随机整数
RandomManager.instance.getRandomInt(min, max, 3);
根据最大值,最小值范围生成随机数数组
var min = 1;
var max = 10;
var n = 10;
// 生成10个1~10之间的随机数数组
RandomManager.instance.getRandomByMinMaxList(min, max, n);
获取数组中随机对象
var objs = [1,2,3,4,5,6,7,8,9]
RandomManager.instance.getRandomByObjectList(objs, 3);
定和随机分配
// 随机5个整数,5个数的和为100
RandomManager.instance.getRandomBySumList(5,100);
边栏推荐
- [hero planet July training leetcode problem solving daily] 25th tree array
- Study on gene targeting preparation of tissue plasminogen activator loaded on albumin nano ultrasonic microbubbles
- The way of understanding JS: write a perfect combination inheritance (Es5)
- 分布式事务 :可靠消息最终一致性方案
- Representation and implementation of stack (C language)
- Pikachu target clearance and source code analysis
- Flask send verification code logic
- nodejs启动mqtt服务报错SchemaError: Expected `schema` to be an object or boolean问题解决
- Preparation of bovine serum albumin modified by low molecular weight protamine lmwp/peg-1900 on the surface of albumin nanoparticles
- 攻防世界web题-favorit_number
猜你喜欢

MySQL - database log

In order to grasp the redis data structure, I drew 40 pictures (full version)

向左旋转k个字符串(细节)

The way to understand JS: the principle of object.call and object.create() inheritance

攻防世界web题-favorit_number

Nodejs learning

基于网络分析和文本挖掘的意见领袖影响力研究

Verilog语法基础HDL Bits训练 06
![[redis] ③ data elimination strategy, pipeline command, publish and subscribe](/img/80/7caeb24380ea026aa8153f2169dfdd.png)
[redis] ③ data elimination strategy, pipeline command, publish and subscribe

Find and locate commands
随机推荐
8个小妙招调整数据库性能优化,yyds
Tarjan 求强连通分量 O(n+m) ,缩点
JVM Tri Color marking and read-write barrier
Detailed explanation of C language preprocessing
MySQL - master-slave replication
sql(基础二)
Nodejs starts mqtt service with an error schemaerror: expected 'schema' to be an object or Boolean problem solving
@The difference between requestparam and @pathvariable annotations
快速入门顺序表链表
牛血清白蛋白修饰牛红细胞超氧化物歧化酶SOD/叶酸偶联2-ME白蛋白纳米粒的制备
C语言 预处理详解
对比7种分布式事务方案,还是偏爱阿里开源的Seata(原理+实战)
Leetcode 笔记 121. 买卖股票的最佳时机
[hero planet July training leetcode problem solving daily] 25th tree array
生物JC UVSSA复合物缓解MYC驱动的转录压⼒ English
Opencv learning Day6
Semaphore
hyperf使用之curd
What is Web3 game?
@RequestParam,@PathVariable两个注解的区别