O'Reilly logo

Go Standard Library Cookbook by Radomir Sohlich

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Generating random numbers

This recipe shows how to generate random numbers. This functionality is provided by the math/rand package. The random numbers generated by math/rand are considered cryptographically insecure because the sequences are repeatable with given seed.

To generate cryptographically secure numbers, the crypto/rand package should be used. These sequences are not repeatable.

 

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required