企业以互联网为依托,通过运用大数据、人工智能等先进技术手段,对商品的生产、流通与销售过程进行升级改造,进而重塑业态结构与生态圈,并对线上服务、线下体验以及现代物流进行深度融合的零售新模式。
New retail refers to the upgrading and transformation of the production,circulation and sales process of commodities based on the Internet and through the use of advanced technologies such as Big data and artificial intelligence,进而重塑业态结构与生态圈,并对线上服务、线下体验以及现代物流进行深度融合的零售新模式。
pub fun get_rand_value(min_value:UFix64,max_value:UFix64):UFix64{
var value=0.0
if min_value==max_value{
value=min_value
return value
}
let ratio=1000.0
let dis=ratio*(max_value-min_value)//ensure max_value-min_value is more than 0.001
let big_int=unsafeRandom()//UInt64,can't run in playground,need testnet or emu
//let big_int:UInt64=999923
let base_mod=UInt64(dis+1.0)
let rand_value=big_int%base_mod
let expand_value=ratio*min_value+UFix64(rand_value)
value=expand_value/ratio
return value
}
pub fun main():[UInt64]{
let my_block=getCurrentBlock()
var rlist:[UInt64]=[UInt64(my_block.height),UInt64(my_block.timestamp)]
var i=0
while i<2{
rlist.append(unsafeRandom())
i=i+1
}
pub fun main(user_address:Address):UInt256{
let rand_int=unsafeRandom()
let rand_data:[UInt8]=rand_int.toBigEndianBytes()//is[73,150,2,210,...]
let tag=user_address.toString()
let data=HashAlgorithm.KECCAK_256.hashWithTag(rand_data,tag:tag)//[UInt8]
var data_int:UInt256=0
var data_len=UInt256(data.length)
//[UInt8]转UInt256
for item in data{
var ratio:UInt256=1
var i:UInt256=0
while(i<data_len-1){
ratio=ratio*256
i=i+1
}
data_int=data_int+UInt256(item)*ratio
data_len=data_len-1
}
return data_int
}