I want to be able generate random numbers of a specific range that are measures where <'T>
could be [<Measure>] type X
or [<Measure>] type Y
let GenerateLine<'T> (rnd:System.Random, min:int<_>, max:int<_>) : (int<_> * int<_>) =
let v1:int< 'T > = rnd.Next(int(min),int(max)+1)
let v2:int< 'T > = rnd.Next(int(min),int(max)+1)
(v1,v2)
I've also tried the same above with the inline
keyword after let
and
let GenerateLine (rnd:System.Random, min max) =
let v1 = rnd.Next(min,max+1) * LanguagePrimitives.GenericOne
let v2 = rnd.Next(min,max+1) * LanguagePrimitives.GenericOne
(v1,v2)
also
let GenerateLine< ^T> (rnd:System.Random, min:< ^T >, max:< ^T > ) =
but I seem to be having no figuring this out or following the logic behind things like How to write a function for generic numbers?
How do you write a method/function that is generic across measures?