Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'Radom integer generation with rule' topicStudent Support Forum > General > "Radom integer generation with rule"

Help | Reply To Topic
Author Comment/Response
Sixten Thestrup
10/12/11 7:52pm

Hey

I have a problem on how to apply rules to random integer generation. For example I want to generate a random list of 5 integers chosen from the integers from 1-40 (without repetition):

RandomSample[Range[40], 5]

The problem is how to apply rules like this:

1) At least one integer must be >31
2) At most two integers in the range 1-12
3) Each of the integers 3,4,and 5 can't be a divisor for more than three of the random generated integers.
4) At most one "pair of integers" e.g. 1 and 2, 22 and 23 etc.

Any suggestions on this?
Thanks in advance!

URL: ,
Help | Reply To Topic