Gamestudio Links
Zorro Links
Newest Posts
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
0 registered members (), 1,094 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
Random in LITE-C ?? #291832
09/28/09 12:14
09/28/09 12:14
Joined: Jan 2005
Posts: 267
the Netherlands
Paulo Offline OP
Member
Paulo  Offline OP
Member

Joined: Jan 2005
Posts: 267
the Netherlands
Hi,

Is my 3d gs buggy?? Im only trying to get a rondom number

code:

Code:
function random_number()
{
var number = 0;
number = integer(random(500));
printf("%i",(int)number );
}



Keeps giving my the same number over and over, 404 :s


The more you have.. the more you can lose...
Dont tell em all you know.....
Re: Random in LITE-C ?? [Re: Paulo] #291840
09/28/09 12:54
09/28/09 12:54
Joined: Aug 2007
Posts: 1,922
Schweiz
Widi Offline
Serious User
Widi  Offline
Serious User

Joined: Aug 2007
Posts: 1,922
Schweiz
Do you have a manual ???

--> random_seed(0);

Re: Random in LITE-C ?? [Re: Widi] #291841
09/28/09 12:56
09/28/09 12:56
Joined: Jan 2005
Posts: 267
the Netherlands
Paulo Offline OP
Member
Paulo  Offline OP
Member

Joined: Jan 2005
Posts: 267
the Netherlands
x = integer(random(10)); // returns a number between 0 and 9


right out of the manual..


The more you have.. the more you can lose...
Dont tell em all you know.....
Re: Random in LITE-C ?? [Re: Paulo] #291845
09/28/09 13:33
09/28/09 13:33
Joined: Oct 2007
Posts: 5,210
Ä°stanbul, Turkey
Quad Offline
Senior Expert
Quad  Offline
Senior Expert

Joined: Oct 2007
Posts: 5,210
Ä°stanbul, Turkey
if you dont use random_seed(0); or randomize(); function at least once in your app, it will always return same random number when you use same limit. this is also the case in C.


3333333333
Re: Random in LITE-C ?? [Re: Paulo] #291846
09/28/09 13:36
09/28/09 13:36
Joined: Jul 2009
Posts: 36
S
SomebodyNew Offline
Newbie
SomebodyNew  Offline
Newbie
S

Joined: Jul 2009
Posts: 36
Take a closer look at the function's description.
I missed that part at first too.

Random only gives you a series of numbers in a specific order. That means that every time you restart your game... it will use the EXACT same "random" numbers in the order they were used last game.

If you want truly random numbers you first have to make the numbers used by the random-function truly random. Thats why you have to use random_seed if you want to use random numbers.

Just try it and you'll see.

Re: Random in LITE-C ?? [Re: SomebodyNew] #291847
09/28/09 13:43
09/28/09 13:43
Joined: Nov 2008
Posts: 26
France
H
Hirogens Offline
Newbie
Hirogens  Offline
Newbie
H

Joined: Nov 2008
Posts: 26
France
Hi,

I worked for 10 years on "gambling games", and I can tell you never to use "random" compilers .. it's fake.it's joke.

but not a "random generator"

(en français, c'est de la merde)^^

looking on forums mathematician.

If you are some probleme, ask me, may be send you a real professional random generator.

regards
Hirogens


A7 Commercial License.
http://www.wormhole-the-game.com

AMD64 6000+, GTX 280 2GB, 4 GB Ram, Seven
Re: Random in LITE-C ?? [Re: Hirogens] #291857
09/28/09 14:42
09/28/09 14:42
Joined: Jul 2009
Posts: 36
S
SomebodyNew Offline
Newbie
SomebodyNew  Offline
Newbie
S

Joined: Jul 2009
Posts: 36
I'm curious, what do you mean by "it's fake"?
Do you mean random-generators in general?

Je ne comprend pas.

Aide-moi s'il vs plait.

Re: Random in LITE-C ?? [Re: SomebodyNew] #291862
09/28/09 15:01
09/28/09 15:01
Joined: Nov 2008
Posts: 26
France
H
Hirogens Offline
Newbie
Hirogens  Offline
Newbie
H

Joined: Nov 2008
Posts: 26
France
hi,

yes, in general..

the random generator of all compiler are bad.
never use this for a real game.

but it's my opinion...

the same problem for sin,cos,tan function.
never use. use record of sin,cos,tan etc.


regards


Last edited by Hirogens; 09/28/09 15:04.

A7 Commercial License.
http://www.wormhole-the-game.com

AMD64 6000+, GTX 280 2GB, 4 GB Ram, Seven
Re: Random in LITE-C ?? [Re: Hirogens] #291872
09/28/09 17:07
09/28/09 17:07
Joined: Aug 2007
Posts: 1,922
Schweiz
Widi Offline
Serious User
Widi  Offline
Serious User

Joined: Aug 2007
Posts: 1,922
Schweiz
random_seed(0); give you a really random number. At my Game i never have the same number with random after random_seed...

Re: Random in LITE-C ?? [Re: Hirogens] #291873
09/28/09 17:32
09/28/09 17:32
Joined: Oct 2007
Posts: 5,210
Ä°stanbul, Turkey
Quad Offline
Senior Expert
Quad  Offline
Senior Expert

Joined: Oct 2007
Posts: 5,210
Ä°stanbul, Turkey
Originally Posted By: Hirogens

the random generator of all compiler are bad.
never use this for a real game.


what defines "good random generator"?

i mean why do you think it's bad. It generates your random number after all. all of them does that.


3333333333
Page 1 of 2 1 2

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1