Skip to content

Instantly share code, notes, and snippets.

@ambethia
Created December 10, 2017 20:32
Show Gist options
  • Save ambethia/f378815604dc6e34d9108576aa363d38 to your computer and use it in GitHub Desktop.
Save ambethia/f378815604dc6e34d9108576aa363d38 to your computer and use it in GitHub Desktop.
using Neo.SmartContract.Framework;
using Neo.SmartContract.Framework.Services.Neo;
using Neo.SmartContract.Framework.Services.System;
using System.Numerics;
namespace RandomNumbers
{
public class Contract : SmartContract
{
public static void Main()
{
Header header = Blockchain.GetHeader(Blockchain.GetHeight());
ulong randomNumber = header.ConsensusData;
int percentage = (int)(randomNumber % 99);
Runtime.Notify("A random number between 0 and 99:", percentage);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment