Previous Module
Next Module

COMPUTER SYSTEMS: Encoding and compression

COMPUTER SYSTEMS: Network topologies

COMPUTER SYSTEMS: Wired and wireless networks, protocols, and layers

COMPUTER SYSTEMS: Threats to computer systems and networks

COMPUTER SYSTEMS: Operating systems and utility software

ALGORITHMS AND PROGRAMMING: Types of data

ALGORITHMS AND PROGRAMMING: Producing robust programs

ALGORITHMS AND PROGRAMMING: Designing, creating, and refining algorithms

ALGORITHMS AND PROGRAMMING: Artificial Intelligence (AI)

  • RNG can be used to add unpredictability in programs which is useful for things like games and simulations.
  • You must import the random module to use this.

import random

number = random.randint(1, 100)

# Random no. between 1 and 100

 
 

dice = random.randint(1, 6)

print(dice) # Random no. between 1 and 6

Unlock Random number generation (RNG)

Subscribe to SnapRevise+ to get immediate access to the rest of this resource.

Premium accounts get immediate access to this resource.

Previous Module
Next Module