[OpenSCAD] round(rands)
Giles Bathgate
giles.bathgate at gmail.com
Mon Jul 16 22:17:39 CEST 2012
Chris
rands returns a vector (list) of random numbers even though you are
telling it to return one random number in the list.
you need to do:
list=rands(2,10,1,6747);
num1=list[0];
etc...
Regards
Giles
On 16 July 2012 21:12, Chris Thompson <eagleapex at gmail.com> wrote:
> I can't round a random number.
>
> num1 = rands(2,10,1,6747);
> num2 = 9.58674394;
> num3 = round(num1);
> num4 = round(num2);
> echo(num1);
> echo(num2);
> echo(num3);
> echo(num4);
>
> this provides:
> ECHO: [2.422436106950045]
> ECHO: 9.58674394
> ECHO: undef
> ECHO: 10
>
> I don't see anything wrong with trying to get a random integer with
> this method. Is this a bug?
>
>
> Chris Thompson, eagleapex.com
> GPG key available
> "Obscurity is a far greater threat to authors and creative artists
> than piracy" -Tim O'Reilly
> _______________________________________________
> OpenSCAD mailing list
> OpenSCAD at rocklinux.org
> http://rocklinux.net/mailman/listinfo/openscad
> http://openscad.org - https://flattr.com/thing/121566
More information about the OpenSCAD
mailing list