Hot answers tagged


Neither your contract's storage nor its memory are shared with other contracts. What's happening in both code snippets is that the data you're passing to the other contract is encoded into call data and sent to the other contract that way.


As hinted at by Ismael in the comments your question is mostly about the algorithm and is largely answered in the linked stackoverflow question. However the part which is special for Solidity (and Ethereum) is the randomness part. Randomness in deterministic smart contracts is a tough question - there are good and bad solutions for it. So once you decide ...


Try this: function shuffle() external { for (uint256 i = 0; i < numberArr.length; i++) { uint256 n = i + uint256(keccak256(abi.encodePacked(now))) % (numberArr.length - i); uint256 temp = numberArr[n]; numberArr[n] = numberArr[i]; numberArr[i] = temp; } }


My first impression leads me to question the use of a Session structure with begin and end times. That concept seems related to log in and log out processes that are appropriate in a server-centric setting. In Ethereum, you can proceed on the basis that all users are logged in at all times. They will not appear unless they are authenticated. It casts doubt ...

Only top voted, non community-wiki answers of a minimum length are eligible