GLBasic forum

Main forum => Tutorials => Topic started by: markjd on 2010-Aug-28

Title: Help With RND Function
Post by: markjd on 2010-Aug-28
Can someone help me please? I have been working through the tutorials and have started playing around with the RND function but have come across something I am unsure about.


PRINT A, 100, 100
PRINT B, 120, 120

If I run this it generates the numbers 72 and 1. If I run it again it generates 100 and 0. If I run it a third time it goes back to 72 and 1 and a forth time 100 and 0, which doesn't seem very random, what am I doing wrong?
Title: Re: Help With RND Function
Post by: Ian Price on 2010-Aug-28
Use -
Code: (glbasic) [Select]

This gets the timer from the pc and will differ every time. Use it at the start of your program, before you call any random numbers. :)
Title: Re: Help With RND Function
Post by: Wampus on 2010-Aug-29
Very useful information. Thanks all.