| |

VerySource

 Forgot password?
 Register
Search
Author: finalshine

Give me advice

[Copy link]

0

Threads

22

Posts

15.00

Credits

Newbie

Rank: 1

Credits
15.00

 China

Post time: 2020-6-6 10:30:01
| Show all posts
return str16;
Reply

Use magic Report

0

Threads

20

Posts

15.00

Credits

Newbie

Rank: 1

Credits
15.00

 LAN

Post time: 2020-6-7 15:15:02
| Show all posts
Random r=new Random(0);
int iTemp=r.Next(64);
string strRen="01";//Initial
strRen=strRen+Convert.ToString(iTemp, 2).PadLeft(6,'0');
for(int i=0;i<7;i++)
{
strRen+=Convert.ToString(r.Next(256),2).PadLeft(8,'0');
}//I don't know if it means
Reply

Use magic Report

0

Threads

9

Posts

8.00

Credits

Newbie

Rank: 1

Credits
8.00

 China

Post time: 2020-6-9 11:00:01
| Show all posts
Random generation is all you need to generate randomly?
Reply

Use magic Report

0

Threads

5

Posts

6.00

Credits

Newbie

Rank: 1

Credits
6.00

 China

Post time: 2020-6-16 01:00:01
| Show all posts
Random random out a number
Reply

Use magic Report

0

Threads

110

Posts

63.00

Credits

Newbie

Rank: 1

Credits
63.00

 China

Post time: 2020-6-29 13:45:01
| Show all posts
Since the 62 bits are random, then it is directly looped 62 times to generate a random number of 0 or 1.

Random rd = new Random();
            string strRen = "01";
            for (int i = 0; i <62; i++)
            {
                strRen += rd.Next(2).ToString();
            }

I wonder if my understanding is wrong?
Reply

Use magic Report

0

Threads

6

Posts

6.00

Credits

Newbie

Rank: 1

Credits
6.00

 China

Post time: 2020-7-1 16:45:01
| Show all posts
for(int i=0; i<64,i++)
{//The following is the pseudo code
   d = A random number every time: odd number is 1, even number is 0;
   SetBit(i, d);
}

The first part is fixed, it is not a problem:
//The first part is 00
SetBit(0,0);
SetBit(1,0);
//The first part is 01
SetBit(0,0);
SetBit(1,1);
//The first part is 10
SetBit(0,1);
SetBit(1,0);
//The first part is 11
SetBit(0,1);
SetBit(1,1);

Whichever you want, just add it after the loop ends.
Within the SetBit function, it is sufficient to use bit operations to set specific bits, which should not be difficult to achieve.
Reply

Use magic Report

0

Threads

6

Posts

6.00

Credits

Newbie

Rank: 1

Credits
6.00

 China

Post time: 2020-7-1 19:30:01
| Show all posts
To add, the landlord finds an Int64 or UInt64 variable to perform SetBit function operation on it.
Reply

Use magic Report

0

Threads

6

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

Post time: 2020-7-12 22:30:01
| Show all posts
long xx=new Random().Next()+new Random(tmp).Next(); //Generate a 64-bit number

xx=xx&0011111...1B; //Head 2 is 00
xx=xx | 1100000...0B; //Modify the first 2 digits to a fixed number
//Modify the first 2 digits as fixed numbers, where the fixed number is 11
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-7-21 07:45:01
| Show all posts
Isn't it 64 bit?
Then directly generate a random long int (note that on a 32-bit machine, it may be 32-bit, the same as int).
Then use bitset to set the first two bits to 00, 01, 10, or 11,
Then take 3 digits, 14 digits, 20 digits, 25 digits,
Isn't it all random?
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list