Library Routines - MOD, DIV, Random

Library routines are ready-made pieces of code you can use in your programs. This lesson covers DIV, MOD and RANDOM, and how they are used, for example to check whether a number is even or odd.

Key terms

Library routine
A pre-written subroutine that can be used in your own programs.
DIV
Returns the integer quotient of a division.
MOD
Returns the remainder. 17 MOD 5 is 2. Often used to test for even or odd.
RANDOM
Generates random numbers, which is useful for creating unpredictable behaviour in games.

Part of Programming.