SRL Archive - Help and Support

Dividing :S


Zezi

2008-06-07 20:51:41

Is it possible to divide by an extended, random number as in
1 + random(0.99)

Is there anyway to do this? :\

(The only way i've thought of getting it is…)

number := (random(3000) / 1000) + 1);

Any ideas please help >.<

Bobarkinator

2008-06-07 20:56:07

The function "Rand" will give you a random extended number less than 1

Harry

2008-06-07 21:57:25

I hear if you do a x.00 it will divide it equaly. Is that what you are saying? Like how SCAR automaticly rounds div?

Cazax

2008-06-07 22:56:12

Simple:

Number := Random(Number) + 0.0;

Jackrawl

2008-06-08 02:09:12

From: Cazax
Simple:

Number := Random(Number) + 0.0;


and why not
Number := Random(Number);
?

n3ss3s

2008-06-08 05:09:07

If you want SCAR to do a division and possibly return a float, atleast one of the two values must be a float.


5/2 returns 2, but 5.0 / 2 returns 2.5 and 5 / 2.0 returns 2.5, 5.0 / 2.0 aswell.

So, to make an integer a float, to a variable you need to do + 0.0, or if it's in the "number form", just change it to a float, like 5'd be 5.0 etc…

Otherwise both Div and / return the division with the modulus(Sp?) taken out… And nope, it's not an auto-round-system, because 5/2 rounded up returns 3, not 2…


Wait a second, I don't have access to a SCAR atm, if 5/2 returns 3 instead of 2 then ignore my post =D

Drakan

2008-06-08 10:08:41

This is how you do it:

5 / 0

Trust me it will work! :D

Jason2gs

2008-06-08 13:26:53

From: The[Cheese]
This is how you do it:

5 / 0

Trust me it will work! :D


Nah. Benland is the only one that can divide by zero.

(Or Chuck Norris, but there are speculations that Benland is Chuck Norris in disguise.)

Jackrawl

2008-06-08 14:59:27

From: Jason2gs
Nah. Benland is the only one that can divide by zero.

(Or Chuck Norris, but there are speculations that Benland is Chuck Norris in disguise.)


Benland is my undoer.