Here’s the translation of the Go random numbers example to OCaml, formatted in Markdown suitable for Hugo:
The Random module in OCaml’s standard library provides pseudorandom number generation.
To run the program, save it as random_numbers.ml and use ocaml to execute it:
Some of the generated numbers may be different when you run the sample.
Note that OCaml’s Random module uses a different algorithm than Go’s math/rand/v2 package. OCaml uses a linear congruential generator, while Go uses a permuted congruential generator (PCG). This means that even with the same seed, the sequences of random numbers will be different between the two languages.