Pick random decimal not working?

image
image
I'm probably just not doing it right, though...

IIRC It doesn't do non-integers

A while ago - I found an algorithim to produce - 0 to 0.9999999999999

image

It always produces the same sequence so if you want random - wrap it in loop to start it ou#ff

image

PS AND is bitwise AND [edit thanks Brian - it was late :slight_smile: ]

image

But...
image
I remember seeing someone make it report from 0 to 1 as a decimal, but I don't remember exactly how other than 0.0 to 1.0 (which didn't work).
Or maybe that's with a different block..

I must have mis-remebered sorry :frowning:

A "workaround"

image

it will produce slightly too many 0 and 1 but would anyone care or notice? :slight_smile:

image
image

image
image

Watch this project

This is an inside joke: The joke is inside the block

Haha, very clever

Hmm, yeah, we should provide a solution to that. I don't really like treating 1.0 as a different number from 1 (no mathematician would agree with that), and the 0.999999999999999 solution works pretty well, so maybe something like loucheman's PICK RANDOM REAL.

I think the typical solution has been to say
(pick random 0 to 10000) / 10000.

You mean, "AND is bitwise and."

It might have to do with JS. I just checked BYOB 3 and it works fine:
Screenshot (56)
Screenshot (57)
Screenshot (58)

Interesting. Thanks.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.