Generate random element programmatically.