pragma solidity ^0.4.24; contract DeveloperFactory { // Let's create a Developer! event NewDeveloper(uint devId, string name, uint age); uint public maxAge = 100; uint minAge = 5; string s; uint public h =0; uint public id; string constant statictext = "HelloStackOverFlow"; bytes constant byteText = "HelloStackOverFlow2"; bytes constant byteText2 = "HelloStackOverFlow2"; struct Developer { string name; uint id; uint age; } uint[] ids; Developer[] private developers; function _createDeveloper( string _name, uint _id, uint _age ) private{ id = developers.push( Developer( _name, _id, _age ) ); emit NewDeveloper(id, _name, _age); } function _generateRandomId( string _str ) private returns (uint){ uint rand = uint(keccak256(abi.encodePacked(_str))); s=_str; h=rand; return rand; } function createRandomDeveloper( string _name, uint _age ) public { require(_age > minAge); require(_age < maxAge); uint randId = _generateRandomId( _name ); _createDeveloper(_name, randId, _age ); } }
0.4.24