Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
0
Members

Uncaught ReferenceError: RNG is not defined

A topic by ATPA9 created Jan 08, 2016 Views: 1,304 Replies: 3
Viewing posts 1 to 4

I tried to make a random number, but I get that error.

awake(){

var ran = new RNG('w');

Sup.log(ran.random(1,10))

}

Is there something wrong with my code

(+6)

Hi ! If you just want to pick an random number, you should use:

let number = Sup.Math.Random.integer(min, max) - For an integer

or

let number = Sup.Math.Random.float(min, max) - For an decimal number

I hope I helped you :)

(+2)

Thanks for helping me so quickly:D

you helped me a lot

(+1)

For info - There is a problem with the 0.19.0 release which broke RNG class. Yvanor's tip fixes it for now, but for future randomization RNG is the way to go, Math.Random doesn't support seeding so it becomes very difficult to find bugs with randomized behavior. The fix was commit on Jan 15 Github 589a6d9