|
Author |
Topic: from float to int (Read 361 times) |
|
gabon
|
from float to int
« on: Sep 6th, 2004, 12:23pm » |
|
I need to calculate randomly the element in an array, how to conver the float received from the random to the int i need to select the item? cheers, chr
|
|
|
|
JohnG
|
Re: from float to int
« Reply #1 on: Sep 6th, 2004, 2:53pm » |
|
int x=int(random(array_size));
|
|
|
|
gabon
|
Re: from float to int
« Reply #2 on: Sep 7th, 2004, 10:40am » |
|
sorry, i found it... is it from java or a p5 conversion? thx, chr
|
|
|
|
mKoser
|
Re: from float to int
« Reply #3 on: Sep 12th, 2004, 1:16pm » |
|
the Java way of doing things is: int myNum = int(myFloat); the processing way of doing things is: int myNum = (int)myFloat; both work within processing. + mikkel
|
mikkel crone koser | www.beyondthree.com | http://processing.beyondthree.com
|
|
|
TomC
|
Re: from float to int
« Reply #4 on: Sep 12th, 2004, 3:48pm » |
|
Other way around. Java uses the C-style (int)whatever, Processing offers a function-style int(whatever) version too.
|
« Last Edit: Sep 12th, 2004, 4:56pm by TomC » |
|
|
|
|
|