From the course: Learning the Go Standard Library

Unlock the full course today

Join today to access over 22,500 courses taught by industry experts or purchase this course individually.

Random number generation

Random number generation - Go Tutorial

From the course: Learning the Go Standard Library

Start my 1-month free trial

Random number generation

- [Instructor] In this example, we're going to see how to generate random values with the "random" package. So generating and using random numbers are pretty common use cases in a variety of programming scenarios, and Go provides an easy to use random number generator which you can read more about at this link here in the docs. So let's just scroll down really quickly, and you can see that there's a whole bunch of ways to generate random numbers. We can generate floats and integers. We can create permutations, we can shuffle items around. And we'll see how to do these in the rest of the chapter as well. So let's go ahead and jump into our code editor and try out some of these random functions. So here in the Start for chapter three, I'm going to go into the Random folder and open a random start. And I'll go ahead and uncomment my module imports. So just like most random number generators, they are actually…

Contents