# Answer to Question #2356 in C# for Nony

Question #2356

Hi All,

I am trying to update my SQL table with 0 and 1. I have design a code that enables me to read sql table and write the result to text file. The problem is that i would like to convert 0 values to 1 randomly based on percent. For example, assume that table A is columns *4 rows with values 0 and 1.

The current percentage of 1 is 6/16. which is %37.5 I would like to increase the current percentage to 50%. To do so i need to convert randomly additional two 0s to 1 to get the total 8 of values 1. I appreciate your assistant in advance.

For example:

Table A

a1 a2 a3 ... am

1 0 0 1 ... 1

2 0 1 0 ... 0

3 0 0 1 ... 0

4 1 1 0 0

...

n

I am trying to update my SQL table with 0 and 1. I have design a code that enables me to read sql table and write the result to text file. The problem is that i would like to convert 0 values to 1 randomly based on percent. For example, assume that table A is columns *4 rows with values 0 and 1.

The current percentage of 1 is 6/16. which is %37.5 I would like to increase the current percentage to 50%. To do so i need to convert randomly additional two 0s to 1 to get the total 8 of values 1. I appreciate your assistant in advance.

For example:

Table A

a1 a2 a3 ... am

1 0 0 1 ... 1

2 0 1 0 ... 0

3 0 0 1 ... 0

4 1 1 0 0

...

n

Expert's answer

Submit your question as an assignment to our control panel set the deadline and our programmers will assist you.

Need a fast expert's response?

Submit orderand get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

## Comments

## Leave a comment