4 Replies Latest reply on May 25, 2009 4:53 PM by Michael Borbor

# Math question

Hello!

I need a solution for a function that receives 3 paramaneters: min, max and totalValues.

What it does is to generate [totalValues] numbers between min and max which are equidistant.

Example: linespace(1,10,100) should generate 100 (real) values between 1 and 10.

Thank you!

• ###### 1. Re: Math question

Sorry for the second "intervention", of course I can get the "step" by dividing the max value to the totalValues and running a for from 1 to totalValues in which I add the "step" to the min value and keep increasing it by that, but that would not be very fast for totalValues equal to 10,000.

Is there such a Math function like MatLab's linespace or Python's inRange etc?

• ###### 2. Re: Math question

Yeah probably, that'll be the the way to go using a for loop. Flex doesn't have a built-in function that you want probably there's one at riaforge.org or at Google Code.

But I can garantee you that any library uses a loop to calculate the numbers. It's not magic, it's just math. A P4 can calculate 1.700 MIPS so I don't think a 10.000 times loop will be a problem.

• ###### 3. Re: Math question

Aha! Thanks!

I was looking for a binary-written function (so to speak), but I'll do this.