Post Reply 
Numworks - strange random numbers
03-06-2023, 08:50 PM
Post: #7
RE: Numworks - strange random numbers
(03-05-2023 02:32 PM)EdS2 Wrote:  
(03-04-2023 08:02 PM)Albert Chan Wrote:  Tried on https://www.numworks.com/simulator/, it make no sense.

> min({0.5, random()})

0.5
0.9116125675
0.5
0.5
0.5140082607
0.06554496133

Could this be a case of min() evaluating the arguments more than once?

I am thinking along the same lines. Perhaps it evaluates each expression in the list, determines which one produced the minimum value, and evaluated that expression again.

That would also explain why the average value of min({random(), random()}) would be 0.5. It wouldn't matter what the first two random() calls produced. One of those expressions would be the minimum, so it would evaluate that expression again, i.e. call random() again for the final result.

— Ian Abbott
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Numworks - strange random numbers - ijabbott - 03-06-2023 08:50 PM



User(s) browsing this thread: 1 Guest(s)