lk8a_2m
lk8a_2m

Reputation: 95

How do you do negative random number (gamemaker studio)?

Can you use

irandom(-10,10)

to generate negative numbers? Or does this function provides only number >=0? There is no information in documentation of GML.

Upvotes: 0

Views: 1300

Answers (1)

Dmi7ry
Dmi7ry

Reputation: 1777

A few examples:

a = -1 * irandom(10);

a = -irandom(10);

a = irandom(20) - 10;

a = irandom_range(-10, 10);

Upvotes: 2

Related Questions