You might be interested to know that a decentralised blockchain Lottery already exists (using Automated Transactions or AT which you can read about here:
http://ciyam.org/at).
Although AT is not yet on any Bitcoin clone yet (it is live on Burst though already) a bounty has been put up for that (of 20 BTC) and a suggested way that this could be achieved (requiring just one new op-code for Bitcoin Script) has been outlined.