GK SCIENTIST

General Knowledge One Stop Source
Menu
  • Home
  • Social Science
    • History
    • Political Science
    • Geography
  • Science
    • Physics
    • Chemistry
    • Biology
  • Chemistry Notes
  • Mathematics
  • Computer
  • Tutorial MySQL
  • Tutorial Python
  • Java Tutorial
  • English Grammar
  • English Essay
  • Indian Anthropology
  • Philosophy
  • Solved Paper
  • UPSC
  • Current Content
    • Current Affairs
    • RSTV News
    • Yojana and Kurukshetra Gist
  • Donate
  • Contact Us

If you are interested in advertising to our audience, submit the advertising enquiry form.

Advertising Enquiry
Computer

Python Random Module

Gk Scientist December 3, 2022 No Comments
Tweet WhatsApp Telegram

Python Random Module:

We can use the PyCharm code editor for this example. If you do not know about it then follow this link- How to install PyCharm for Python and create a program in it.

(1) The random module provides tools for making random selections. Random numbers are used for games, simulations, testing, security, and privacy applications.

(2) randint()– The randint() function in the program takes two integer arguments and returns a random integer between those two integers (including the integers). The numbers generated by the randint() function are not truly random. They are produced from a pseudorandom number generator algorithm, which takes an initial number and produces other numbers based on a formula.

python randint function - Python Random Module

(3) randrange()– The randrange() function is used to select a pseudorandom int from a given range. It can be used with one, two, or three parameters to specify a range exactly as with the range function. For example, randrange (1, 4) returns some number from the range [1,2,3], and randrange (2,12,2) returns a multiple of 2 between 2 and 10, inclusive. Note- ranges go up to, but do not include, the stopping value.

python randrange function - Python Random Module
randrange function in python - Python Random Module

(4) choice()– The choice() function will return a randomly selected item from the list.

python random choice function - Python Random Module

(5) shuffle()– The shuffle() function will reorder the items in a list. This function modifies the list in place, rather than returning a new list.

python shuffle function - Python Random Module

(6) random()– The random() function returns a random float number between 0 and 1.

random function in python - Python Random Module

(7) uniform()– The uniform() function returns a random float number between two given parameters.

uniform function in python - Python Random Module

Tutorial Python
Tutorial MySQL
Computer Memory
Database Management System (DBMS)
Application Software
Python (programming language)– Wikipedia
Prev Article
Next Article

Related Articles

MySQL Cross Join
MySQL Cross Join: The CROSS JOIN clause returns the Cartesian …
Gk Scientist November 17, 2022 Computer

MySQL Cross Join

Email (Electronic Mail)
Email: Electronic Mail is sending and receiving messages by a …
Gk Scientist September 16, 2022 Computer

Email (Electronic Mail)

Arithmetic Expressions in Java
Arithmetic Expressions in Java: We can use the Eclipse IDE …
Gk Scientist December 29, 2022 Computer

Arithmetic Expressions in Java

Create Java MenuBar and Menus
Create Java MenuBar: We can use the Eclipse IDE for …
Gk Scientist January 17, 2023 Computer

Create Java MenuBar and Menus

Procedure-Oriented Programming
Procedure-Oriented Programming: Procedure-Oriented Programming is the traditional way of programming, …
Gk Scientist August 14, 2022 Computer

Procedure-Oriented Programming

Java KeyListener
Java KeyListener: We can use the Eclipse IDE for this …
Gk Scientist January 18, 2023 Computer

Java KeyListener

MySQL Commit and Rollback
MySQL Commit and Rollback: (1) The COMMIT Statement commits changes …
Gk Scientist November 16, 2022 Computer

MySQL Commit and Rollback

Python SQLite Search Query
Python SQLite Search Query: We can use the PyCharm code …
Gk Scientist December 9, 2022 Computer

Python SQLite Search Query

Leave a Reply Cancel Reply

Search

  • Popular
  • Recent




GK SCIENTIST

General Knowledge One Stop Source

Information

  • About Us
  • Terms and Condition, Disclaimer
  • Contact Us

Android Apps

  • IAS App For English Medium Students
  • IAS Basics App For English Medium Students
  • IAS Hindi App For Hindi Medium Students
DMCA.com Protection Status

Popular Tags

Biology (33) Biology Questions (88) Chemistry (57) Computer (215) Current Affairs (4) Current Content (0) Economy (17) English Essay (172) English Grammar (75) English Literature (10) Geography (83) History (259) Indian Anthropology (11) Indian Polity (14) JKAS Mains Question Papers (17) Mathematics (68) Moral Science (7) NCERT & Other Boards Books (25) Philosophy (114) Physics (89) Political Science (132) RS TV News (33) Science (553) Social Anthropology (7) Social Science (17) Solved Paper (47) UPSC (7) UPSC Mains Question Papers (26)

Downloads

  • NCERT Books
  • Old NCERT Books
  • NIOS Books For IAS, SSC, and State PSC Exam
  • Tamil Nadu Board Books: Important For UPSC, SSC, and State PSC Exam
  • Modern Indian and World History Notes For IAS Exam
  • UPSC Topper 2013 Gaurav Agrawal Notes For IAS Preparation
  • UPSC IAS Prelims General Studies – Previous Year Papers
  • UPSC Mains Question Papers

Copyright © 2023 GK SCIENTIST
Theme by MyThemeShop.com& Hosted On Cloudways

Ad Blocker Detected

Our website is made possible by displaying online advertisements to our visitors. Please consider supporting us by disabling your ad blocker.

Refresh
 

Loading Comments...