How does the bit generator work?

Discussion of open issues, suggestions and bugs regarding database management and development tools for SQL Server
Post Reply
MarkLeavesley
Posts: 6
Joined: Fri 17 Jun 2016 12:57

How does the bit generator work?

Post by MarkLeavesley » Wed 21 Oct 2020 11:43

I have two bit columns, for this example we'll call them "red" and "blue". I am trying to achieve:
  • 75% of the records have red only ticked
  • 20% of the records have blue only ticked
  • 4% of the time both are ticked
  • 1% of the time none are ticked
As a starter I am only doing the first two requirements.

"red" is set to true 75% of the time with seed 205
"blue" is set to true 20% of the time with seed 206

In the preview I get "red" is true 50% and "blue" is false 100%?

As I test I changed "red" to be true 0% and surely enough all are false. Change it to 10% and I get 1 true, change it to 20%...still only 1 true, 30% = 2, 40% = 4, 50% = 4, 60% = 4, 70% = 4, 80% = 7, back to 70% and still 4, 90% = 9, back to 80% and still 7, 100% = 10, back to 70% and still 4. I have emailed this in.

alexa

Re: How does the bit generator work?

Post by alexa » Fri 23 Oct 2020 09:07

The specified generator works on the principle to generate a subsequent value with the defined probability of hitting into the specified range. Therefore, as wider the range of the values being generated, the more precise will be the result. The selection from 10 values is quite a small range.

Post Reply