Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
公瑾
/
lucky-draw
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
6c92b0e3
authored
2019-12-31 18:44:02 +0800
by
zhangyongfeng
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
chrome v8 MathRandom
1 parent
7b0f2b51
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
0 deletions
src/helper/algorithm.js
src/helper/algorithm.js
View file @
6c92b0e
/**
* chrome v8 实现
*/
/*
// ECMA 262 - 15.8.2.14
var rngstate; // Initialized to a Uint32Array during genesis.
function MathRandom() {
var r0 = (MathImul(18030, rngstate[0] & 0xFFFF) + (rngstate[0] >>> 16)) | 0;
rngstate[0] = r0;
var r1 = (MathImul(36969, rngstate[1] & 0xFFFF) + (rngstate[1] >>> 16)) | 0;
rngstate[1] = r1;
var x = ((r0 << 16) + (r1 & 0xFFFF)) | 0;
// Division by 0x100000000 through multiplication by reciprocal.
return (x < 0 ? (x + 0x100000000) : x) * 2.3283064365386962890625e-10;
}
*/
/**
* 取范围内随机整数
* @param {number} minNum
* @param {number} maxNum
...
...
Please
register
or
sign in
to post a comment