Hi,
maybe you can do something like this.
Make a list of as many elements as the size of the range in randc
e.g. randc has a range of 0..7 you need 8 elements
each element has an index. This index is going from 0 ... 7
each element has a weight. This can be a real number between 0.0 ... 1.0
now fill your list. For the idx use your range. For the weight you can use the rand function
e.g. you will get
E[0].idx = 0; E[0].weight = 0.453;
E[1].idx = 1; E[1].weight = 0.150;
E[2].idx = 2; E[2].weight = 0.934;
E[3].idx = 3; E[3].weight = 0.443;
E[4].idx = 4; E[4].weight = 0.109;
E[5].idx = 5; E[5].weight = 0.034;
E[6].idx = 6; E[6].weight = 0.657;
E[7].idx = 7; E[7].weight = 0.234;
now you can sort your list by the the weight
in may example you will get
E[0].idx = 5; E[0].weight = 0.034;
E[1].idx = 4; E[1].weight = 0.109;
E[2].idx = 1; E[2].weight = 0.150;
E[3].idx = 7; E[3].weight = 0.234;
E[4].idx = 3; E[4].weight = 0.443;
E[5].idx = 0; E[5].weight = 0.453;
E[6].idx = 6; E[6].weight = 0.657;
E[7].idx = 2; E[7].weight = 0.934;
If you now use the idx of your sorted list you have a randc function
In may example you get 5,4,1,7,3,0,6,2
best regards