A little help using randint(), please... - Programmers Heaven

Howdy, Stranger!

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

Categories

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.