private void RunScript(Interval domain, int count, int seed, ref object A, ref object B)
{
System.Random random = new System.Random();
var s = (int) (domain.Min);
var e = (int) (domain.Max);
dynamic list = new List<dynamic>(0);
dynamic selection = 0.1;
var n = count <= e - s ? count : e - s;
for(int j = 0;j < (int) n ;j++){
int nx = n;
for(int i = j;i < nx;i++){
selection = random.Next(s, e + 1);
if(list.Contains(selection) && list.Count <= n)
continue;
else if(list.Count <= n)
list.Add(selection);
if(list.Count >= n)
break;}
if(list.Count >= n)
break;
}
B = list;
hi is there way to faster my code for(random integer not duplicate Number)c#?
random integer no duplicatenumber.gh (9.5 KB)
1 post - 1 participant