Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Generating a random number in SML

Tags:

random

sml

How can you generate a random number from a specific range, for example the integer 34 in the range [1, 100]?

I looked at the Random structure but it doesn't give me what I want, at least from what I can understand.

like image 703
froli Avatar asked Oct 30 '25 07:10

froli


1 Answers

I think you have to use the Random structure in the given link like this ...

- val nextInt = Random.randRange (1,100);
- val r = Random.rand (1,1);
- val x1 = nextInt r;
- val x2 = nextInt r;
like image 106
gruenewa Avatar answered Nov 01 '25 14:11

gruenewa



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!