Group Abstract Group Abstract

Message Boards Message Boards

0
|
4.3K Views
|
1 Reply
|
0 Total Likes
View groups...
Share
Share this post:
GROUPS:

Range of values except x

Posted 11 years ago
POSTED BY: Goncalo Faria
Posted 11 years ago

If within your Do loop you know the index of the value that you want to exclude (and suppose that index is k), then outside of your Do loop you could use

w = Flatten[Table[{y/100}, {y, 50}]]
e = Range[1, 50]

and within the Do loop (which I assume determines the index k in some fashion)

z = RandomChoice[Delete[w, k] -> Delete[e, k], 1]

which just removes that item from both w and e and makes the random selection.

POSTED BY: Jim Baldwin
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard