# Double convertTo.int?(Help)

I want Covert(double to int )… For use as index(Because the Random number produced from Double)
how?

covert.int.gh (9.4 KB)

``````  private void RunScript(int seed, double lenght, double v, Interval domain, ref object A, ref object B)
{
Vector3d pt = new Vector3d();
var rnd = new Random(seed);
var list = new List<double>();
List < Vector3d > vx = new List  <Vector3d>{new Vector3d(v, 0, 0),new Vector3d(-v, 0, 0),new Vector3d(0, v, 0),new Vector3d(0, -v, 0),new Vector3d(0, 0, v),new Vector3d(0, 0, -v)};

double index;

for(var i = 0; i < 6; i++)
{
}

index = Math.Round(list[0], 0);
int indexN = Convert.ToInt(index);

pt = vx[indexN];
A = pt;
B = index;
``````

int myInteger =(int) myDouble;

1 Like

thanks

1 Like

And other questions = How is the equivalent of this phrase in C #?
python=

``````if y in x:
a="true"
else:
a="false"
``````

and in c# how?

``````
if(y in x)
{ A = "Ture";}
else
{ A = "false";}
``````

test in List.gh (8.2 KB)

if(x.Contains(y)) I guess

1 Like

THANKS