Cheatsheet: Data Structures
    Array / List
    Map / Dict
    Set
    Tuple
    Struct / Data Class
    Stacks
    Other Data Structures
    Collection Conversions
Cheatsheet: Control Flow
Cheatsheet: Class

Polyglot CheatSheet - Random

Updated: 2022-04-25

Java

Random random = new Random(System.currentTimeMillis())

JavaScript

Generate a random number between 0 and 1:

Math.random();

Generate a random integer:

function getRandomInt(max) {
  return Math.floor(Math.random() * max);
}

Python

>>> import random
>>> random.random()
0.12062307072338296