joyceljy9990

50 Reputation

5 Badges

9 years, 105 days

MaplePrimes Activity


These are questions asked by joyceljy9990

For example,

I have original bit :=[10000000]. after encryption by using technique cryptography, I get thecipher text:=[11110011]. Then I need to measure the total flipped bit in the cipher text with the original bit. Have any method can calculate the total flipped bit? Can someone help me? Thank you.

For example, I havd matrix m:=[0 1 0 1 0 1 0], I want to convert it back to m:=[0,1,0,1,0,1,0]. Can someone help to solve? Thank you.

Does anyone know how to do crossover between block of binary number?

Example :

If I have 4 blocks, [0011001],[0011100], [0101010], and [1001110].

the first block will crossover with the second block, the second block will crossover with the third block, the third block will crossover with the last block and the last block must crossover with the first block. 

I had tried the code as below. 

for i from 1 to 4 do

for j from 1 to 7 do

block[i][j]:=block[i+1][j];

end do;

new_block[i]:=block[i];

end do;

The problem is the crossover can be done from 1 with 2, 2 with 3 and 3 with 4. But this code unwork for crossover for last block with the first block. Can someone help me? thank you in advance.

How to random generate 2 integer number with condition x must be less than y ?

I had tried the coding below. But the output shown not what i want.

x:=RandomTools[Generate](integer(range=1..7);

y:=RandomTools[Generate](integer(range=1..7);

if x>= y then x:=RandomTools[Generate](integer(range=1..7); y:=RandomTools[Generate](integer(range=1..7); end if;

 

Example:

I get x:= 5 , y:=1, then i need to regenerate the value of x and y using the last statemet above. but the problem is sometime i might still get the value of x>= y for example on second generate x:3, y=2. I need a code that x and y must be regerate until it get x<y. Can someone help ? Thank you in advance.

 

1 2 3 Page 3 of 3