Page 1 of 1

question to math.random

PostPosted: Mon Jul 09, 2012 11:30
by tkerwel
in the moment i tortue my brain (at least the rest which is function in my age...)

i need a random number between x and z.

when i use math.random (x,z) so i get a number between x and z, but this is not a real random number, every start its the same numer again.

so when i use math.random (0, os.time()) i ot a large number beween 0 and os.time...

any idea what i can do to get that down like 1 to 6 ?

PostPosted: Mon Jul 09, 2012 11:34
by mauvebic
you need to add this before running random

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
math.randomseed(os.time())

PostPosted: Mon Jul 09, 2012 11:58
by tkerwel
thanks...

or

danke schön ...

so easy...was already try to doi that with a loop with rondom wide an inside i always use math.random.... jesus i did not see the tree inside the wood... (old german saying...translation sounds a bit silly *gg* )