Matriz como forma-la para o JOptionPane

Pessoal, tenho seguinte código:

import javax.swing.JOptionPane;
import java.util.Random;

public class Exercicio0904 {
public static void main (String [ ] args) {

String str = "";
int nr_pessoas = 0;
String nome = "";
int senha = 0;
int numero = 0;

char [ ] codigo = new char [ ] {'1', '2', '3', '4', '5', '6', '7', '8', '9', '0'};

Random rdm = new Random ( );

for (int j = 1; j <= 8; j++) 
senha += codigo [ rdm.nextInt (10) ];



str = "Quantos candidatos?";
String num = JOptionPane.showInputDialog (null, str);
nr_pessoas = Integer.parseInt (num);

String [ ] [ ] lista = new String [nr_pessoas] [senha];  

for (int i = 1; i <= nr_pessoas; i ++) {
str = "Nome " + i;
nome = JOptionPane.showInputDialog (null, str);
lista [i - 1] [0] = nome;
}



System.exit (0);
}
}

Eu quero que cada pessoa receba uma senha, como monto isso e exibo no JOptionPane?
Quem puder ajudar, obrigado!

Pelo que pude entender vendo seu codigo, sua logica esta errada neste ponto.

		for (int j = 1; j &lt;= 8; j++) {
			senha += codigo[rdm.nextInt(10)];
		}

Não precisa disso.

Correto seria assim:

[code]
String[][] lista = new String[nr_pessoas][2];

	for (int i = 1; i &lt;= nr_pessoas; i++) {
		str = &quot;Nome &quot; + i;
		nome = JOptionPane.showInputDialog(null, str);
		senha = codigo[rdm.nextInt(10)];
		lista[i - 1][0] = nome;
		lista[i - 1][1] = (senha + &quot;&quot;);
	}
	String message = &quot;&quot;;
	for (int i = 0; i &lt; lista.length; i++) {
		message += &quot;Nome: &quot; + lista[i][0] + &quot; senha: &quot; + lista[i][1] + &quot;\n&quot;;
	}
	JOptionPane.showMessageDialog(null, message);[/code]

Valeu!