use Debug.Log to see the value of [ ]

I want to get the value of this Random.Range so I can use it in an if code in another script. This code is used to change the color of a circle.
Here is the code:
Rend.sharedMaterial = material [Random.Range (0,4)];

I was using the Debug.Log to see the value but have been able to make that work.

int rand = Random.Range(0,4);. If you need to access it from other scripts make it public.

I must be doing something wrong. When I put it into the code I don’t get any error messages but when I try to access it buy using Debug.Log I get an error message. Which part of

int rand = Random.Range (0,4);

what do I use in Debug.Log ( );


i just used Debug.Log (rend.sharedMaterial) and it returned the right value. This should give me what I need to compare values in an if statement. Still have to resolve how to read this in another script and how to use the value which is -----White (UnityEngine Material) and 4 other colors. I thought it was going to return the number position of the color in the log but I am sure once I know how to read the White and use it in code then I should be fine.