Click here to Skip to main content
15,896,912 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
we need source code for divide and shuffle their position in c# for our visual cryptography project

What I have tried:

We could not get the source for divide and shuffle their positions of images in c#
Posted
Updated 22-Sep-17 1:27am

Quote:
We could not get the source for divide and shuffle their positions of images in c#
That's the point: you have to write the source. After all it is your project, you have to develop it.

Suppose you divide the image like a mosaic, then you have a matrix of subimages. To shuffle them you simply swap randomly their indices, say
image[i][j]<->image[m][n] where i,j,m,n are random integers in the allowed ranges.
 
Share this answer
 
Quote:
we need source code

As programmer, your job is to create algorithms that solve specific problems and you can't rely on someone else to eternally do it for you, so there is a time where you will have to learn how to. And the sooner, the better.

Shuffling:
Shuffling - Wikipedia[^]
An efficient way for shuffling (computer way)
All you need is a deck of cards, cards are at positions 1 to 52.
Draw a number 1 to 52, swap that card with card 52.
Draw a number 1 to 51, swap that card with card 51.
Draw a number 1 to 50, swap that card with card 50.
and so on until shuffling is done.

I let you translate to code.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900