problem with Delete[]
- To: mathgroup at smc.vnet.net
- Subject: [mg58917] problem with Delete[]
- From: Heath Gerhardt <heathgerhardt at hotmail.com>
- Date: Sat, 23 Jul 2005 05:32:47 -0400 (EDT)
- Organization: Department of Computer Science, University of Calgary
- Sender: owner-wri-mathgroup at wolfram.com
Hello,
Delete[] is not removing elements of v in the following function, could
anyone tell me why?
Rn[N_, p_] := Module[{A, v, c, q, i, j},
A = Table[0, {i, 1, N}, {j, 1, N}];
v = Table[i, {i, 2, N}];
c = 1;
For[i = 1, i < N, i++,
j = Random[Integer, {1, Dimensions[v][[1]]}];
A[[c, v[[j]]]] = 1;
A[[v[[j]], c]] = 1;
q = Random[];
If[q > p, c = v[[j]]];
Delete[v, j];
];
A
]
thanks in advance,
Heath