Hello again.... Remember last post on this??? Scratch it, that problem solved, new one arised (actually, it was never ok in the first place)
Right now it all has narrowed to a javascript/math problem.... If anyone can take a look at it, help me/us, I would highly appreciate it!!! Its a simple/stup1d problem, I solved some time ago for another project, and suddenly it was erased from my mind or smth... :-( Im no mathematician, sorry... dont know the correct jargon, so please, bear with me: Situation: Given an array of objects: a[0] = object; a[1] = object; a[2] = object; a[3] = object; a[n] = object; and a number ranging 0-1 (floats) I need to know to which item of the array the value corresponds. Lets put it into variables: known values: p = [0 - 1] (ranges from zero to one, floating numbers) n = Amount of elements in the array s = How much this element takes in the whole array (1 / a.length) unknown: X = should be between 0 and (a.length-1) X, is the %^&%&%&[EMAIL PROTECTED])* value I still cant get.... :-( eg. - A has 5 elements - each element would take 0.2 'space' from A (being '1' the total) Expected results: if p == 0.15 then X == 0 (its the 1st element) if p == 0.45 then X == 2 (its in the 3rd element) if p == 0.24 then X == 1 (its in the 2nd element) Any ideas????? Thanks!!!! BTW, you can take a look at this here: http://ivanicus.com/moo/
