Skip to content

Conversation

@gpersoon
Copy link
Owner

@gpersoon gpersoon commented Dec 6, 2024

No description provided.

// SPDX-License-Identifier: MIT
// Load in remix: remix.loadurl("https://github.com/web3examples/ethereum/solidity_examples/Casino.sol")
// Carefull with gas-estimates: due to random this doesn''t allways work
pragma solidity >=0.7.0 <0.9.0;
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This allows for an old version of solidity!

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Documented in #3

So the conversion can be resolved

/// @dev this is not secure but only to demonstrate
/// @return a pseudo random number
function getRandom() public view returns(uint256) {
return uint256(keccak256(abi.encodePacked(block.difficulty, block.coinbase, block.timestamp)));
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its dangerous to use this for random

@gpersoon gpersoon mentioned this pull request Dec 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants