There an interesting page about contracts on the Ripple Wiki.
My limited understanding of contracts is that like other transactions in Ripple, it is the consensus across many servers that ensures validity. Am I right that when a contract is running in Ripple, the code runs on multiple servers and consensus ensures the contract's instructions are run correctly?
If so, I'm particularly curious about the "Lotto" example on the wiki page. It chooses one account randomly to be paid some amount of some currency.
If that code ran simultaneously on many Ripple servers, they'd each randomly choose a different winner. How would they ever achieve consensus?