Questions tagged [random]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1 vote
1 answer
57 views

function call gives me "pending.."

I have a problem with a function in a lottery contract. given that library for pseudorandom: library Random { /* * @dev startingValue is inclusive, endingValue is inclusive * naive implementation! ...
user avatar
0 votes
1 answer
30 views

Generating Random Number in Solidity is pending

pragma solidity ^0.8.0; uint256 private RandNonce = 0; function RandomNumber() public returns(uint256){ uint256 rand = uint(keccak256(abi.encodePacked(block.timestamp,msg.sender,...
user avatar
0 votes
0 answers
24 views

Random number generator

I am trying to hack a random number generator contract as follows : // SPDX-License-Identifier: MIT pragma solidity 0.8.0; contract Guess { uint256 private randNonce; uint256 private result;...
user avatar
0 votes
0 answers
8 views

How is it made sure that the validator that is chosen for Proof of stake randomly is real 'random'? [duplicate]

By what process is a Validator selected randomly?
user avatar
0 votes
1 answer
17 views

Generating psuedo-random numbers from a non-verified contract

I understand that since psuedo-randomness in solidity is deterministic, miners and hackers will be able to reverse engineer or manipulate the pieces to force their hand. However, if I had a separate ...
user avatar
1 vote
1 answer
39 views

Best way to get notified when fallback arrived

When you request random number, the Chainlink VRF2 returns it by calling following function. function fulfillRandomWords( uint256, /* requestId */ uint256[] memory randomWords ) ...
user avatar
  • 989
0 votes
1 answer
70 views

Correct way of using Random() Function while using Loops in solidity?

I want to generate a random number several times using a loop. I am currently using block.timestamp logic but it is giving the same number on every iteration. Which is correct I think because the ...
user avatar
1 vote
1 answer
96 views

What is the max number of inputs that can be entered in a keccak256(abi.encodePacked()) function?

I'm learning to use the keccak function on cryptozombies, and seeing that this function takes three inputs: uint(keccak256(abi.encodePacked(now, msg.sender, randNonce))) made me wonder how many ...
user avatar
0 votes
2 answers
16 views

How does delaying on-chain randomness effect the security of number guessing games?

Say a number guessing game allows users to submit their guess before block N and reveals the winning number N + 100 games later, which is random number based on the block hashes of block N until block ...
user avatar
0 votes
0 answers
68 views

Random DNA mix in Solidity

Hello I have DNA mix function and I am trying to implement random function while mixing DNA for example dad DNA is 10 10 10 10 10 10 10 10 10 10 and mum DNA is 21 21 21 21 21 21 21 21 21 21 and child ...
user avatar
0 votes
0 answers
50 views

Unknown issue in solidity random function

I using this function to generate random numbers (example value of that 3 variables are commented in code below) this code sometimes works and sometimes does not. when I tested with manual value and ...
user avatar
0 votes
1 answer
131 views

Randomizing values in mintable NFTs

I've read and written simple smart contracts in the past yet I'm relatively new to getting random data in a transaction, which seems to be harder than I've thought, due to the nature of determinism of ...
user avatar
0 votes
1 answer
103 views

Commit reveal scheme with random number -- user chooses when to reveal... possible?

I've researched commit reveal schemes, but am not sure the following is possible... User mints a playing card. The number of card is hidden. At anytime, the user can choose to reveal the card number. (...
user avatar
  • 166
0 votes
2 answers
263 views

On-chain Random Number Generator

I've been doing some research on gasleft() (used to be msg.gas but is now deprecated) and was unable to find any specifics on how or where this value is defined. I was able to find another detailed ...
user avatar
0 votes
1 answer
353 views

Generate random nft art from characteristics

What is the best way to generate random art from characteristics? I’m looking into creating profile picture nfts like how wicked craniums, punks and bored bananas are random. Also what is the best way ...
user avatar
  • 1
0 votes
1 answer
26 views

Would this be a good choice?

Would this pseudo random algorithm be failproof: I'm implementing a lottery contract and the winner is chose by getting addresses of each player who joined , packing the addresses into a string and ...
user avatar
0 votes
2 answers
903 views

Can you get an array of random numbers?

The question says it all. Can I get an array of random numbers in solidity?
user avatar
0 votes
1 answer
41 views

Help to get variable in a pseudo random lottery contract

Hi everyone at the other side! I'm doing a pseudo random lottery contract on solidity. It's working 100% good. The logic of the contract is that a player pays for getting a number in order to match ...
user avatar
1 vote
1 answer
1k views

Chainlink VRF fulfillRandomness doesn't use enough gas to perform function - how to get it to use more?

Chainlink VRF allows users to get a random number by calling requestRandomness and then waiting for the fulfillRandomness callback to be called by the Chainlink contract. I have a function ...
user avatar
2 votes
1 answer
1k views

Ensuring a fair distribution of an NFT set?

Suppose I have 1000 NFT's I would like to distribute. The user can see what any NFT looks like in advance, but they don't know what they'll be getting until they actually buy it. In other words, there ...
user avatar
1 vote
2 answers
3k views

Random BigNumber in ethers.js

I'm looking to generate a random ethers.js BigNumber in a certain range. While this question has answers about random number generation, the answers as of this writing (April 2021) only cover BigInt, ...
user avatar
0 votes
0 answers
338 views

Alternatives to get LINK tokens in Ropsten, for RNG

Sorry if this question sounds like very newbie (and maybe it is. I'm developing a Smart Contract which needs a random number generation, and after researching some time it seems that ChainLink VRF ...
user avatar
  • 705
1 vote
1 answer
154 views

Call Smart Contract At Unpredictable Time

Is there a call scheduling service that lets you schedule a call at a time in the future not predictable by someone with access to contract code and transaction details? The scheduling services I've ...
user avatar
  • 11
0 votes
1 answer
442 views

Minereum Lucky Draw claims 100% Safe randomness on a smart contract without oracles, is it really possible? [duplicate]

Is the way Minereum Lucky Draw game works really safe 100% onchain RNG and verifiable on smart contract? They claim yes but I would like to know expert technical answer for this, if so, isn't this a ...
user avatar
  • 9
2 votes
2 answers
1k views

Generating random uint256 numbers in JS

I need to generate a uint256 random number offchain (in a Node.js client). Since BN doesn't have a random() function, what's the best way to do so?
user avatar
  • 143
3 votes
2 answers
4k views

Generating random number in Solidity without Chainlink

Hello I'm well aware there are plenty of threads around discussing different methods. Just curious and wanted to ask directly here because feel like the situation might be different. Essentially I'm ...
user avatar
0 votes
1 answer
34 views

Proof that a variable is truly random [duplicate]

I have thinking of the wonder that an application could offer if it could prove that some of its data are truly random and so not controlled. Can the ethereum blockchain offer such a service and how ...
user avatar
  • 151
0 votes
1 answer
312 views

Blockhash Minus-256 Problem [duplicate]

What is meant by Blockhash Minus-256 Problem? I am reading an article at: Bad Randomness It talks about Blockhash Minus-256 problem but does not explain much about it. As a result I can’t ...
user avatar
  • 1,233
1 vote
1 answer
252 views

How can I convert an element of a byte32 array to number?

The array contains an SHA256 hash. I want to add up 2 hexadecimal values, and later multiply them by 1.125 (only keeping integer). The resulted number would represent an alphanumerical character, it ...
user avatar
  • 25
3 votes
0 answers
21 views

Oraclizer does not respond periodically

Contract that use oraclizer work just fine from moment of deploy. But three days ago oraclizer start to ignore requests of my contract(not allways). In this trx oracle dont return callback, but when ...
user avatar
2 votes
1 answer
317 views

Multiple callbacks with provable random oracle

I'm making a simple lottery game where there are hourly, daily and weekly prizes. My contract has functions to pick winners for each of these game types. Each game types will have different number of ...
user avatar
  • 341