Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

A little help using randint(), please...

FoolOfTomorrowFoolOfTomorrow Posts: 20Member
Hi! Could anyone please explain exactly how to use randint()? I have read in the help and in the example that comes with python but i still cannot get it... please help!

Comments

  • infidelinfidel Posts: 2,900Member
    : Hi! Could anyone please explain exactly how to use randint()? I have read in the help and in the example that comes with python but i still cannot get it... please help!

    What is there to get?

    [code]
    >>> import random
    >>> help(random.randint)
    Help on method randint in module random:

    randint(self, a, b) method of random.Random instance
    Return random integer in range [a, b], including both end points.
    [/code]

    If you want to pick a random integer between 1 and 6 (to simulate a die roll, perhaps), you call random.randint(1, 6).


    [size=5][italic][blue][RED]i[/RED]nfidel[/blue][/italic][/size]

    [code]
    $ select * from users where clue > 0
    no rows returned
    [/code]

  • FoolOfTomorrowFoolOfTomorrow Posts: 20Member
    : : Hi! Could anyone please explain exactly how to use randint()? I have read in the help and in the example that comes with python but i still cannot get it... please help!
    :
    : What is there to get?
    :
    : [code]
    : >>> import random
    : >>> help(random.randint)
    : Help on method randint in module random:
    :
    : randint(self, a, b) method of random.Random instance
    : Return random integer in range [a, b], including both end points.
    : [/code]
    :
    : If you want to pick a random integer between 1 and 6 (to simulate a die roll, perhaps), you call random.randint(1, 6).
    :
    :
    : [size=5][italic][blue][RED]i[/RED]nfidel[/blue][/italic][/size]
    :
    : [code]
    : $ select * from users where clue > 0
    : no rows returned
    : [/code]
    :
    :
    That helped a lot, Thanks!
Sign In or Register to comment.