What is means of 50% of the time

so " Math.random() >= .5 , Statistically speaking, this expression will return true 50% of the time, and false the other 50%."

The question is, how do we get the value of the time?

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:83.0) Gecko/20100101 Firefox/83.0.

Challenge: Render Conditionally from Props

Link to the challenge:

1 Like

Hey @aldhaneka. I think you misread that paragraph. It says that 50% chances are that this expression will return true and 50% chances are that this expression will return false. The time in that paragraph is not said as a unit. This reply may sound odd, but I don’t know how to say this!

1 Like

Well, when you think about it, it’s actually an intuitive way of looking at it.
Since Math.random() gives you values is between 0(inclusive) and 1(exclusive) randomly. The value larger or equal to .5 accounts for half of the chances of all tries, so it’s ok to say half of the time (of all tries). And it sounds more friendly, to human brains. :slight_smile:

And this is the way (or one of the way? I’m not sure) of how we control the possibility of specific events happening.

-Adina

1 Like

Right, like paulsontech is saying, it’s just how we say it in English. (I’m sorry, aldhaneka, I’m inferring that you’re not a native English speaker.) paulsontech explained it, but let me see if I can extend on that.

Right, “time” in this sense does not refer to “clock time” but to an “occurrence”. It would be like if I said to my wife, “Do you remember the time we went to that restaurant?” I’m asking her to remember the “event” or “occurrence”, not what time it said on her watch.

So, something like:

Statistically speaking, this expression will return true 50% of the time

is meant to be read as:

Statistically speaking, this expression will return true 50% of the occurrences

or

Statistically speaking, this expression will return true 50% of the instances

or

Statistically speaking, this expression will return true 50% of the events

Another way to say it might have been:

Statistically speaking, this expression has a 50% probability of evaluating to true.

2 Likes

oh, is it will return true if your wife says an occurrence that is a 50% (50% until 100%) chance of the event actually happening?

Think of it this way, if I say it rains 50% of the time, that means that there is a 50% chance of rain. It is an odd use of the word “time”, but languages are like that.