<p>I am trying to use the <code>import random</code> statement in python, but it doesn't appear to have any methods in it to use.</p>

<p>Am I missing something?</p>

[{'answer_id': 74445, 'author': 'jamuraa', 'author_id': 9805, 'author_profile': 'https://Stackoverflow.com/users/9805', 'pm_score': 2, 'selected': False, 'text': '<p>I think you need to give some more information.  It\'s not really possible to answer why it\'s not working based on the information in the question.  The basic documentation for random is at: \n<a href="https://docs.python.org/library/random.html" rel="nofollow noreferrer">https://docs.python.org/library/random.html</a></p>\n\n<p>You might check there.  </p>\n'}, {'answer_id': 74459, 'author': 'Chris AtLee', 'author_id': 4558, 'author_profile': 'https://Stackoverflow.com/users/4558', 'pm_score': 0, 'selected': False, 'text': "<p>Can you post an example of what you're trying to do?  It's not clear from your question what the actual problem is.</p>\n\n<p>Here's an example of how to use the random module:</p>\n\n<pre><code>import random\nprint random.randint(0,10)\n</code></pre>\n"}, {'answer_id': 74476, 'author': 'Vinko Vrsalovic', 'author_id': 5190, 'author_profile': 'https://Stackoverflow.com/users/5190', 'pm_score': 1, 'selected': False, 'text': '<pre><code>Python 2.5.2 (r252:60911, Jun 16 2008, 18:27:58)\n[GCC 3.3.4 (pre 3.3.5 20040809)] on linux2\nType "help", "copyright", "credits" or "license" for more information.\n&gt;&gt;&gt; import random\n&gt;&gt;&gt; random.seed()\n&gt;&gt;&gt; dir(random)\n[\'BPF\', \'LOG4\', \'NV_MAGICCONST\', \'RECIP_BPF\', \'Random\', \'SG_MAGICCONST\', \'SystemRandom\', \'TWOPI\', \'WichmannHill\', \'_BuiltinMethodType\', \'_MethodType\', \'__all__\', \'__builtins__\', \'__doc__\', \'__file__\', \'__name__\', \'_acos\', \'_ceil\', \'_cos\', \'_e\', \'_exp\', \'_hexlify\', \'_inst\', \'_log\', \'_pi\', \'_random\', \'_sin\', \'_sqrt\', \'_test\', \'_test_generator\', \'_urandom\', \'_warn\', \'betavariate\', \'choice\', \'expovariate\', \'gammavariate\', \'gauss\', \'getrandbits\', \'getstate\', \'jumpahead\', \'lognormvariate\', \'normalvariate\', \'paretovariate\', \'randint\', \'random\', \'randrange\', \'sample\', \'seed\', \'setstate\', \'shuffle\', \'uniform\', \'vonmisesvariate\', \'weibullvariate\']\n&gt;&gt;&gt; random.randint(0,3)\n3\n&gt;&gt;&gt; random.randint(0,3)\n1\n&gt;&gt;&gt;  \n</code></pre>\n'}, {'answer_id': 74485, 'author': 'Chris Bunch', 'author_id': 422, 'author_profile': 'https://Stackoverflow.com/users/422', 'pm_score': 0, 'selected': False, 'text': '<p>Seems to work fine for me. Check out the methods in the <a href="http://docs.python.org/lib/module-random.html" rel="nofollow noreferrer">official python documentation</a> for random:</p>\n\n<pre><code>&gt;&gt;&gt; import random\n&gt;&gt;&gt; random.random()\n0.69130806168332215\n&gt;&gt;&gt; random.uniform(1, 10)\n8.8384170917436293\n&gt;&gt;&gt; random.randint(1, 10)\n4\n</code></pre>\n'}, {'answer_id': 75360, 'author': 'Thomas Vander Stichele', 'author_id': 2900, 'author_profile': 'https://Stackoverflow.com/users/2900', 'pm_score': 0, 'selected': False, 'text': '<p>Works for me:</p>\n\n<pre><code>Python 2.5.1 (r251:54863, Jun 15 2008, 18:24:51) \n[GCC 4.3.0 20080428 (Red Hat 4.3.0-8)] on linux2\nType "help", "copyright", "credits" or "license" for more information.\n&gt;&gt;&gt; import random\n&gt;&gt;&gt; brothers = [\'larry\', \'curly\', \'moe\']\n&gt;&gt;&gt; random.choice(brothers)\n\'moe\'\n&gt;&gt;&gt; random.choice(brothers)\n\'curly\'\n</code></pre>\n'}, {'answer_id': 75427, 'author': 'Jerry Hill', 'author_id': 12773, 'author_profile': 'https://Stackoverflow.com/users/12773', 'pm_score': 6, 'selected': True, 'text': "<p>You probably have a file named random.py or random.pyc in your working directory.  That's shadowing the built-in random module.  You need to rename random.py to something like my_random.py and/or remove the random.pyc file.</p>\n\n<p>To tell for sure what's going on, do this:</p>\n\n<pre><code>&gt;&gt;&gt; import random\n&gt;&gt;&gt; print random.__file__\n</code></pre>\n\n<p>That will show you exactly which file is being imported.</p>\n"}, {'answer_id': 76404, 'author': 'tzot', 'author_id': 6899, 'author_profile': 'https://Stackoverflow.com/users/6899', 'pm_score': 1, 'selected': False, 'text': '<p>If the script you are trying to run is itself called random.py, then you would have a naming conflict. Choose a different name for your script.</p>\n'}, {'answer_id': 78304, 'author': 'Johan Dahlin', 'author_id': 14337, 'author_profile': 'https://Stackoverflow.com/users/14337', 'pm_score': 2, 'selected': False, 'text': "<p>This is happening because you have a random.py file in the python search path, most likely the current directory.</p>\n\n<p>Python is searching for modules using sys.path, which normally includes the current directory before the standard site-packages, which contains the expected random.py.</p>\n\n<p>This is expected to be fixed in Python 3.0, so that you can't import modules from the current directory without using a special import syntax.</p>\n\n<p>Just remove the random.py + random.pyc in the directory you're running python from and it'll work fine.</p>\n"}]
['https://Stackoverflow.com/questions/74430', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/13050/']