It does not load the specific module of random when you run it as a .py. But if I load it in the python shell, I have no problems.
# -*- coding: utf-8 -*- #
You can try re-naming the file and try again