# Return class help

**URL:** <https://forum.kirupa.com/t/return-class-help/257491>\
**Category:** Uncategorized\
**Created:** [April 14, 2008, 5:59pm UTC](https://forum.kirupa.com/t/return-class-help/257491 "2008-04-14T17:59:48Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![knickers95](https://avatars.discourse-cdn.com/v4/letter/k/a8b319/32.png) [@knickers95](https://forum.kirupa.com/u/knickers95)\
**Post date:** [April 14, 2008, 5:59pm UTC](https://forum.kirupa.com/t/return-class-help/257491/1 "2008-04-14T17:59:48Z")

</div>

im converting a load of my old AS2 classes into AS3 and im having problems with this one class i have. It is a class full of custom math functions, and all they do is they use the numbers given to them, and return a new value. simple. And it worked fine in AS2. but for some reason AS3 doesnt like it.

This is basically what ive done:

```auto
package
{	
	public class Math2
	{
		public function randRange(l:Number, h:Number):Number
		{
			return Math.round(l + (Math.random() * (h - l)));
		}
	}
}

```

this function returns a random number between the two given values.

and in the AS3 .fla, i put this into the key frame:

```auto
import Math2;

trace(Math2.randRange(1, 10));

```

But i keep getting an error message that says:

“1195: Attempted access of inaccessible method randRange through a reference with static type Class.”

And i dont know why it doesnt work.

Many thanks in advanced 😃
