Skip to content

Latest commit

 

History

History
17 lines (15 loc) · 449 Bytes

README.md

File metadata and controls

17 lines (15 loc) · 449 Bytes

Guess a number

Write a function with type:

guess5 : int -> bool * int

with the following behaviour. When guess5 is applied to a parameter n, it first checks if n is in the range 1..5; if not, it fails. Otherwise, it generates a random number r between 1 and 5, and it returns a pair (b,r), where b is true iff n equals to r.

Hint. Use the function:

Random.int(n)

to generate a random integer in the range 0..n-1.