[Include] random.inc - Random System
#1

Description
Now I Writed A Include That Just Do Two Very Important Work.This Include Simulate a C# Random Function.
(Note: This Include Based On 'native random(max);' And You Need a_samp.inc and float.inc)

Functions
Код:
native Random(min, max);
native RandomFloat(Float:min, Float:max, accuracy = 4);
The Important Benefits In This Include, Just The Min, Max Values And Random Float.
RandomFloat, Does Some Math Calculations To Return A Completly Random Float.

Return Values
Random:

A Random Value: Everything Is Right.
0: Something Is Wrong And A Error Occured.

Errors:
Max Value Is Equal Or Smaller From Min Value.
Min Or Max Values Are Negative.

RandomFloat:

A Random Float Value: Everything Is Right.
0.0: Something Is Wrong And A Error Occured.

Errors:
Accuracy Is Bigger From 6 Or Smaller From 1.
Max Value Is Equal Or Smaller From Min Value.
Min Or Max Values Are Negative.

Examples
Random(min, max):

Код:
printf("Random (10 - 65):%d",Random(10,65));
Output Can Be (65 - 10 =) 55 Items.Here Is Some Outputs:
Код:
Random 10 - 65:41
Random 10 - 65:17
Random 10 - 65:36
Random 10 - 65:57
Random 10 - 65:28
---------------------------
RandomFloat(Float:min, Float:max) :

Код:
printf("Random Float (5.1 - 44.7):%f",RandomFloat(5.1,44.7));
Output Can Be Too Many Items.Here Is Some Outputs(We Dont Put Accuracy; And its By Default 4):
Код:
Random Float (5.1 - 44.7):17.2981
Random Float (5.1 - 44.7):27.1247
Random Float (5.1 - 44.7):9.1954
Random Float (5.1 - 44.7):41.2458
Random Float (5.1 - 44.7):35.5884
Download
random.inc
Reply


Messages In This Thread
random.inc - Random System - by hesambia - 08.09.2014, 06:39
Re: random.inc - Random System - by iFarbod - 08.09.2014, 07:11
Re: random.inc - Random System - by KingServerIRAN - 08.09.2014, 07:42
Re: random.inc - Random System - by Stinged - 08.09.2014, 07:54
Re: random.inc - Random System - by hesambia - 08.09.2014, 09:28
Re: random.inc - Random System - by amirab - 08.09.2014, 09:37

Forum Jump:


Users browsing this thread: 1 Guest(s)