Random numbers but with a bias

N

nurrrthk

Hi,
I need to populate a test table with some random numbers.
Example : 0 or 1.
I fill in the table with "= Randbetween(0;1)" and that does the trick.

But now I need to bias the data so there is - for example -
twice a many chances of 0 than there is of 1.

How would I do that ?

TIA
Nurrrrthk
 
L

Luke M

=IF(RANDBETWEEN(0,2)=2,1,0)

If random number is 1 or 0, returns 0. If 2, returns 1. This gives the value
of 0 a 2-1 advantage.
 
L

Lars-Åke Aspelin

Hi,
I need to populate a test table with some random numbers.
Example : 0 or 1.
I fill in the table with "= Randbetween(0;1)" and that does the trick.

But now I need to bias the data so there is - for example -
twice a many chances of 0 than there is of 1.

How would I do that ?

TIA
Nurrrrthk

Try this formula:

=INT(RANDBETWEEN(0,2)/2)

Hope this helps / Lars-Åke
 
N

nurrrthk

Thanks
I'll give that a blast.
nurrrthk


Luke M said:
=IF(RANDBETWEEN(0,2)=2,1,0)

If random number is 1 or 0, returns 0. If 2, returns 1. This gives the
value
of 0 a 2-1 advantage.
--
Best Regards,

Luke M
*Remember to click "yes" if this post helped you!*
 
N

nurrrthk

This works too.
Based on your idea but with an implied IF.


=(RANDBETWEEN(0;10) < 4 ) *1

Testing if RANDBETWEEN(0;10) is smaller than 4, returns TRUE or FALSE,
multiplied by 1 gives 1 or 0.

nurrrthk
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top