当前位置:网站首页>[oops framework] random number generation management
[oops framework] random number generation management
2022-07-26 00:38:00 【dgflash_ game】
Functional specifications
OopsFramework- Random number generation management module , Encapsulates the seedrandom Third party random database
Instructions
Set random seeds
// Random seeds can be sent by the server to other clients , The same seed , When multiple terminals are random for the same number of times , The result is the same
RandomManager.instance.setSeed(123456789);
Generates a random integer in a specified range
var min = 1;
var max = 10;
// [min,max) Get a random integer between two numbers , This value is not less than min( If min If it's not an integer , Get a rounded up min), And less than ( But not equal to )max
RandomManager.instance.getRandomInt(min, max, 1);
// [min,max] Get a random integer between two numbers , Including two numbers , This value ratio min Big ( If min Is not an integer , That's not less than min Big integers ), But less than ( But not equal to )max
RandomManager.instance.getRandomInt(min, max, 2);
// (min,max) Get a random integer between two numbers
RandomManager.instance.getRandomInt(min, max, 3);
According to the maximum value , The minimum range generates an array of random numbers
var min = 1;
var max = 10;
var n = 10;
// Generate 10 individual 1~10 An array of random numbers between
RandomManager.instance.getRandomByMinMaxList(min, max, n);
Get random objects in the array
var objs = [1,2,3,4,5,6,7,8,9]
RandomManager.instance.getRandomByObjectList(objs, 3);
Fixed sum random assignment
// Random 5 It's an integer ,5 The sum of the numbers is 100
RandomManager.instance.getRandomBySumList(5,100);
边栏推荐
- Redis命令参考手册 - Key
- How to open the Internet and ask friends to play together?
- The way of understanding JS: what is prototype chain
- Super super super realistic digital people! Keep you on the air 24 hours a day
- P4047 [JSOI2010]部落划分
- Research on the integrated data quality management system and technical framework under the scenario of data circulation and transaction
- 向左旋转k个字符串(细节)
- 寻找命令find和locate
- hcia综合实验
- Research on the influence of opinion leaders based on network analysis and text mining
猜你喜欢
随机推荐
How to use 120 lines of code to realize an interactive and complete drag and drop upload component?
2022/7/24 考试总结
letfaw
Redis(八) - Redis企业实战之优惠券秒杀
[calculate the number of times that one string is equal to another string]
向左旋转k个字符串(细节)
Pikachu靶机通关和源码分析
Jmeter之用户自定义变量和抽离公共变量
HOOPS Exchange助力混合计算流体动力学软件搭建3D格式导入读取功能 | 客户案例
Are you still counting the time complexity?
Solve page refresh without attaching data
快速入门顺序表链表
Preparation of bovine serum albumin modified by low molecular weight protamine lmwp/peg-1900 on the surface of albumin nanoparticles
HCIP第十三天
牛血清白蛋白修饰牛红细胞超氧化物歧化酶SOD/叶酸偶联2-ME白蛋白纳米粒的制备
JVM Tri Color marking and read-write barrier
Research on the influence of opinion leaders based on network analysis and text mining
实战演练 | 查找在给定时间范围内购买超过 N 件商品的客户
SQL (basic 2)
Nest. JS uses express but not completely









