Git Product home page Git Product logo

rnd-gen-svr's Introduction

区块链量子随机数生成器接口说明

SocketIO

事件

"newrandom": 新随机数生成事件,数据: {random: "xxxx", index: n}

字段 说明
random 随机数
index 当前随机数的索引值

Http

[GET] :/random/getInfo

用于获取指定随机数的计算源

参数

字段 说明
hash 指定随机数的hex字符串值
index 指定随机数的index索引值
两个字段是2选1的关系,优先使用hash字段

结果

字段 说明
random 随机数hex字符串值
index 随机数index索引值
hashes 计算随机数用到的区块数据,其中item格式:{id: "blockid", height: blockHeight}
iter 迭代次数
sha256iter sha256计算迭代次数

[GET] :/random

用于获取随机数

参数

字段 说明
offset 偏移值
limit 最大限制
reverse 反序: 1-代表反序;0-代表正序

结果

字段 说明
randoms 获取的随机数数组
count 当前总共有多少随机数生成
获取指定索引的随机数时,可以使用{offset: index, limit:1}

[GET] :/random/count

用于获取当前生成随机数的总量

参数 — 无

结果

字段 说明
count 总量

排列组合随机生成器接口说明

Http

[POST] :/lottery

用于获取随机数在一定规则排列组合中的抽取结果

参数

字段 必须 类型 说明
data array 说明排列组合抽取规则的数组,其中数组每个元素是一个包含三项的对象:
{
arr:需要排列组合的数组,
size:排列组合的输出数量,
type:排列组合的类型【0:可重复,1:排列,2:组合】
}
hash string 一个时间塔产生的随机数

结果

字段 说明
index 抽取结果的下标位置
lottery 抽取结果

[POST] :/lottery/pagedata

用于获取随机数在结果集字典中整页的数据

参数

字段 必须 类型 说明
data array 说明排列组合抽取规则的数组,其中数组每个元素是一个包含三项的对象:
{
arr:需要排列组合的数组,
size:排列组合的输出数量,
type:排列组合的类型【0:可重复,1:排列,2:组合】
}
index 与hash二选一 integer 一个时间塔产生的随机数在结果集中的位置(从0开始)
hash 与index二选一 string 一个时间塔产生的随机数
limit integer 每一页结果的数量(不传值默认取一页20个)

结果

字段 说明
lotterys 抽取结果所在页的数据,包含{isChoosed,index,lottery}

rnd-gen-svr's People

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Forkers

0xjohnx

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.