Skip to content

Instantly share code, notes, and snippets.

@ambethia
Created December 10, 2017 21:06
Show Gist options
  • Save ambethia/190280391eed4383f69363414ac14019 to your computer and use it in GitHub Desktop.
Save ambethia/190280391eed4383f69363414ac14019 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()
{
long numberOfTickets = 666;
Header header = Blockchain.GetHeader(Blockchain.GetHeight());
long randomNumber = (long)(header.ConsensusData >> 32);
long winningTicket = (randomNumber * numberOfTickets) >> 32;
Runtime.Notify("The winning ticket is:", winningTicket);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment