I would remove the dropout part, as:
- dropout is more a model training technique
- discrete node are hard to train
If you really want something identical, you can try using the theano raw random stream and index to it:
http://deeplearning.net/software/theano/library/tensor/raw_random.html