Importing nested packages

Report a typo

Mary has created a Go program that can generate a random number based on a seed that the user inputs. However, for the program to work correctly, she needs to import the sub-package rand from the math package.

How can Mary import the nested rand package? Help her out by fixing the code below.

Take notice that to solve this task, you must not change the code within the main function!

Sample Input 1:

12

Sample Output 1:

9
Write a program in Go
package main

import (
"fmt"
// import the rand package here.
)

// DO NOT change the code within the main function!
func main() {
var num int64
fmt.Scanf("%d", &num)

r := rand.New(rand.NewSource(num))
fmt.Println(r.Intn(50))
}
___

Create a free account to access the full topic