I’m having a hardtime figuring out on how can I generate a twice repeating random number ranges from 1-8 and make it a matrix like this:
5 8 2 5
3 6 4 1
7 6 2 3
4 7 8 1
By the way I plan to make this on android.
Thanks in advance.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I assume you want a randomized 4x4matrix containing all the numbers 1-8 twice.
You can easily turn a list of 16 numbers into a 4x4matrix. So what you need is a randomized list of the 1-8 numbers.
To turn this list in a matrix, just read row by row, 4 numbers at a time.