Math.random() function, which generates a random floating-point number between 0 and 1. While this function has been sufficient for many use cases, developers have often had to turn to external libraries or the
crypto library for more advanced random number generation.
Some of the new functions include:
random.randint(a, b) : generates a random integer between a and b, inclusive.
random.randrange(start, stop, step) : generates a random number from a range of numbers, with an optional step value.
random.shuffle(arr) : shuffles the elements of an array in place.
random.choice(arr) : selects a random element from an array.
These new features provide developers with more flexibility and control when working with random numbers, and make it easier to write more efficient and secure code.
It is worth noting that the new random library also includes new secure random generators, which are cryptographically secure and suitable for generating secure tokens and other sensitive data.