AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Perfect Random Nummer (https://forums.alliedmods.net/showthread.php?t=118213)

NiQu 02-08-2010 17:14

Perfect Random Nummer
 
How do i generate a random number?
When i use random_num(1, 10); it usally gives the same number multiple times in a row.

Example:
/roll
Outcome: 1
/roll
Outcome: 1
/roll
Outcome: 1

When i want to make a random number its normaly because i want to check if a random number is 3 then do this and that, but always the three first ones gets either correct numbers or incorrect numbers.

Why is this? and how can i fix it?

wrecked_ 02-08-2010 17:23

Re: Perfect Random Nummer
 
This might help.
Exolent's Retrieving a Random Value from an Array without Using it More Than Once Guide
You'd probably need to modify the things in the tutorial to your need. For the array, make it like
PHP Code:

new array[4] = {
     
1,
     
2,
     
3,
     
4



NiQu 02-08-2010 17:25

Re: Perfect Random Nummer
 
Ill look into it.


All times are GMT -4. The time now is 07:25.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.