Random 我正在使用Oraclize获取一个随机数,但N个字节让我感到困惑

Random 我正在使用Oraclize获取一个随机数,但N个字节让我感到困惑,random,callback,solidity,Random,Callback,Solidity,似乎当我给Oraclize查询一个4的N时,它总是返回一个19位数字,这可能是巧合,但我认为不是。如果我想要一个介于0和10*10^18之间的数字呢 这可能吗?这就是我的Oraclize现在的样子: oraclize_setProof(proofType_Ledger); // sets the Ledger authenticity proof uint N = 4; // number of random bytes we want the datasource to ret

似乎当我给Oraclize查询一个4的N时,它总是返回一个19位数字,这可能是巧合,但我认为不是。如果我想要一个介于0和10*10^18之间的数字呢

这可能吗?这就是我的Oraclize现在的样子:

    oraclize_setProof(proofType_Ledger); // sets the Ledger authenticity proof
    uint N = 4; // number of random bytes we want the datasource to return
    uint delay = 0; // number of seconds to wait before the execution takes place
    uint callbackGas = 200000; // amount of gas we want Oraclize to set for the callback function
    bytes32 queryId = oraclize_newRandomDSQuery(delay, N, callbackGas);
在回叫中

        uint maxRange = totalEth -1; // deduct one so that when one gets added later it cant be bigger than the total eth.
        randomNumber = (uint(sha3(_result)) % maxRange) + 1 // this is an efficient way to get the uint out in the [1, maxRange] range