Hi, there is something I want to solve. Here is the problem:
I have an array : alpha[26,26]
I appointed random number(between 0 and 25) to each member of this array but I don't like this situation:
I tell with an example

alpha[0,0]=23,
alpha[0,1]=11,
alpha[0,2]=08, <----
...
alpha[2,2]=08, <----
...
alpha[2,24]=12, <----
...
alpha[3,24]=12, <----
...

I mean, for all second members of array shouldn't have same value. So if we could solve this we would have and array whose second member hasn't same value and all member will contain different value.

Recommended Answers

All 5 Replies

I'm not sure what the problem is. You have a 26x26 array and only 26 unique values. You will have duplicates.

I tell,
I have alpha[26,26] array and each member has a value between 1-26. But each b of [a,b] member must take the value only one time:
alpha[0,1]=12
alpha[0,2]=1
alpha[0,3]=26 <---
alpha[0,4]=2
alpha[0,5]=7
alpha[0,6]=3 <---
alpha[0,7]=11
alpha[0,8]=4
alpha[0,9]=13
alpha[0,10]=21
alpha[0,11]=19
alpha[0,12]=25
alpha[0,13]=14
alpha[0,14]=20
alpha[0,15]=9
alpha[0,16]=24
alpha[0,17]=12
alpha[0,18]=6
alpha[0,19]=26
alpha[0,20]=8
alpha[0,21]=18
alpha[0,22]=22
alpha[0,23]=11
alpha[0,24]=17
alpha[0,25]=12
alpha[0,26]=1
alpha[0,3]=23
alpha[0,4]=5
alpha[0,5]=15
alpha[0,1]=13
alpha[0,2]=10
alpha[0,3]=16

alpha[1,1]=8
alpha[1,2]=19
alpha[1,3]=26 <---
alpha[1,4]=17
alpha[1,5]=4
alpha[1,6]=3 <---
alpha[1,7]=11
alpha[1,8]=24
alpha[1,9]=13
alpha[1,10]=21
alpha[1,11]=18

...........


Best regards,
Emrah

Then adatapost is correct. You need to fill the array with the numbers from 0 to 25, then perform a Fisher-Yates shuffle.

I filled the array with 0-25 unique by meself, not need that metho but I told, some valuables are in the same row. I'm going to try to solve it. Thanx for your suggest. If I solve it, I'll write here. Have a nice day.

I have alpha[26,26] array and each member has a value between 1-26. But each b of [a,b] member must take the value only one time:
alpha[0,1]=12
alpha[0,2]=1
alpha[0,3]=26 <---
alpha[0,4]=2
alpha[0,5]=7
alpha[0,6]=3 <---
alpha[0,7]=11
alpha[0,8]=4
alpha[0,9]=13
alpha[0,10]=21
alpha[0,11]=19
alpha[0,12]=25
alpha[0,13]=14
alpha[0,14]=20
alpha[0,15]=9
alpha[0,16]=24
alpha[0,17]=12
alpha[0,18]=6
alpha[0,19]=26
alpha[0,20]=8
alpha[0,21]=18
alpha[0,22]=22
alpha[0,23]=11
alpha[0,24]=17
alpha[0,25]=12
alpha[0,26]=1
alpha[0,3]=23
alpha[0,4]=5
alpha[0,5]=15
alpha[0,1]=13
alpha[0,2]=10
alpha[0,3]=16

alpha[1,1]=8
alpha[1,2]=12
alpha[1,3]=26 <---
alpha[1,4]=11
alpha[1,5]=2
alpha[1,6]=3 <---
alpha[1,7]=1
alpha[1,8]=7
alpha[1,9]=11
alpha[1,10]=4
alpha[1,11]=13
...........

Best regards,
Emrah

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.