[j-nsp] format of minimum and maximum value of math:random() in SLAX

Michael Loftis mloftis at wgops.com
Thu Jul 5 15:55:50 EDT 2018


idk if there’s a floor function but the general solution is floor(rand() *
16) when rand() produces values 0-1(exclusive) IE if random does not
generate 1.0 - dunno implementation details for slax

On Thu, Jul 5, 2018 at 13:43 Martin T <m4rtntns at gmail.com> wrote:

> Hi!
>
> According to the documentation, math:random() function returns a
> random number with a minimum value of 0 and a maximum value of 1.
> Larger values than 0 and smaller values than 1 have a format similar
> to 0.663341003779015. What is the format of minimum and maximum value?
> Simply 0 and 1? 0.000000000000000 and 1.000000000000000? The reason I
> ask is that I use "substring(math:random(), 3, 2) mod 16" for finding
> random numbers between 0 and 15 and I need to apply a workaround if
> format is not always x.xxxxxxxxxxxxxxx.
>
>
> thanks,
> Martin
> _______________________________________________
> juniper-nsp mailing list juniper-nsp at puck.nether.net
> https://puck.nether.net/mailman/listinfo/juniper-nsp
>
-- 

"Genius might be described as a supreme capacity for getting its possessors
into trouble of all kinds."
-- Samuel Butler


More information about the juniper-nsp mailing list