Randomseed, does it work?

Just starting out? Need help? Post your questions and find answers here.
artnat
User
User
Posts: 12
Joined: Sun Nov 10, 2024 3:34 pm

Randomseed, does it work?

Post by artnat »

I wanted a random sequence, which is always the same. Here a four lines example:

Code: Select all

randomseed = 0
For i.l = 1 To 10
  Debug Random(100000)
Next
I expected alsways the same sequence of ten random numbers, but they are different each time. What am I doing wrong? Or what is the benefit of randomseed?
User avatar
idle
Always Here
Always Here
Posts: 5835
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Re: Randomseed, does it work?

Post by idle »

you need to call the function

Code: Select all

RandomSeed(0)
artnat
User
User
Posts: 12
Joined: Sun Nov 10, 2024 3:34 pm

Re: Randomseed, does it work?

Post by artnat »

Ooooh, I was blind!
User avatar
idle
Always Here
Always Here
Posts: 5835
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Re: Randomseed, does it work?

Post by idle »

artnat wrote: Thu Dec 05, 2024 9:04 pm Ooooh, I was blind!
hehe, that's a normal day for me with dyslexia
Quin
Addict
Addict
Posts: 1122
Joined: Thu Mar 31, 2022 7:03 pm
Location: Colorado, United States
Contact:

Re: Randomseed, does it work?

Post by Quin »

idle wrote: Thu Dec 05, 2024 9:10 pm
artnat wrote: Thu Dec 05, 2024 9:04 pm Ooooh, I was blind!
hehe, that's a normal day for me with dyslexia
And a normal day for me just in general :P
User avatar
jacdelad
Addict
Addict
Posts: 1991
Joined: Wed Feb 03, 2021 12:46 pm
Location: Riesa

Re: Randomseed, does it work?

Post by jacdelad »

idle wrote: Thu Dec 05, 2024 9:10 pm
artnat wrote: Thu Dec 05, 2024 9:04 pm Ooooh, I was blind!
hehe, that's a normal day for me with dyslexia
I have daily sex...no, I mean, I have dyslexia. :wink:
Good morning, that's a nice tnetennba!

PureBasic 6.21/Windows 11 x64/Ryzen 7900X/32GB RAM/3TB SSD
Synology DS1821+/DX517, 130.9TB+50.8TB+2TB SSD
User avatar
idle
Always Here
Always Here
Posts: 5835
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Re: Randomseed, does it work?

Post by idle »

jacdelad wrote: Fri Dec 06, 2024 5:49 am
idle wrote: Thu Dec 05, 2024 9:10 pm
artnat wrote: Thu Dec 05, 2024 9:04 pm Ooooh, I was blind!
hehe, that's a normal day for me with dyslexia
I have daily sex...no, I mean, I have dyslexia. :wink:
enjoy it while your young :lol:
Post Reply