Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Randomize does not change the Seed (*solved*)
#1
Another bug i discovered in the latest dev version is that RANDOMIZE does not change the seed.
I got exactly the same RND numbers with RANDOMIZE 0 as with RANDOMIZE 1 or even RANDOMIZE (without number, after a pause 0 to avoid the fact that the emulator always starts with frame count 0 and uses it as Seed.
Here is the evidence:
Code:
print "Actual Seed: ";peek (uinteger,23670)
randomize 45
print "Seed after Random 45: ";peek (uinteger,23670)
randomize 37
print "Seed after Random 37: ";peek (uinteger,23670)
randomize
print "Randomized seed: ";peek (uinteger,23670)
There is a way around it:
Code:
poke uinteger 23670,peek (uinteger,23672)
This does not rely on RANDOMIZE, it just copies two bytes from frames sysvar to seed sysvar, and gives you every time you start a program, new RND sequence (After a PAUSE 0 or selecting controls).
------------------------------------------------------------
http://lcd-one.da.ru redirector is dead
Visit my http://members.inode.at/838331/index.html home page!
Reply
#2
LCD Wrote:Another bug i discovered in the latest dev version is that RANDOMIZE does not change the seed.
I got exactly the same RND numbers with RANDOMIZE 0 as with RANDOMIZE 1 or even RANDOMIZE (without number, after a pause 0 to avoid the fact that the emulator always starts with frame count 0 and uses it as Seed.
Here is the evidence:
Code:
print "Actual Seed: ";peek (uinteger,23670)
randomize 45
print "Seed after Random 45: ";peek (uinteger,23670)
randomize 37
print "Seed after Random 37: ";peek (uinteger,23670)
randomize
print "Randomized seed: ";peek (uinteger,23670)
There is a way around it:
Code:
poke uinteger 23670,peek (uinteger,23672)
This does not rely on RANDOMIZE, it just copies two bytes from frames sysvar to seed sysvar, and gives you every time you start a program, new RND sequence (After a PAUSE 0 or selecting controls).
I will debug this. But RANDOMIZE now relies in 32 Bit seeds being lower 16-bit SEED system var (23670, 23671) and two upper 16bits in a reserved memory position. I will check this bug.

Thanks!
Reply
#3
Ok, It was a silly bug. It's been fixed. Please re-download.
Also note this beta (alpha?) version supports bOR, bAND, bNOT, bXOR in 8 bit integers.

16 and 32 are not included yet (still buggy). If you try those, the compiler will stop with an strange error.
Reply
#4
boriel Wrote:Ok, It was a silly bug. It's been fixed. Please re-download.
Also note this beta (alpha?) version supports bOR, bAND, bNOT, bXOR in 8 bit integers.

16 and 32 are not included yet (still buggy). If you try those, the compiler will stop with an strange error.
Cool anyway! Thanks, I will download and install it. Even 8 bit only binary manipulation is worth it.
------------------------------------------------------------
http://lcd-one.da.ru redirector is dead
Visit my http://members.inode.at/838331/index.html home page!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)