I have an iPhone version of my application which is using a bit of code for setting up colors.
((rand() % 176) * 80) / 256.0f
I am new to objective c so I can’t figure out how this is working. I want to make exact copy of this for Android in Java.
In Java we usually use Random() . How am i suppose to implement this above function using Random r = Random();
Equivalent one-liner in Java would be:
More about the random class on the JavaDoc
Obviously you should not create a new instance of
Randomeach time.