Author Topic: Question for old time computer programers:  (Read 469 times)

Offline Angus

  • Plutonium Member
  • *******
  • Posts: 10057
Question for old time computer programers:
« Reply #15 on: February 03, 2003, 06:57:26 AM »
I used to write games in Basic so I know this a bit.
The RND function was based on a certain CPU seed, that is true. There was a RANDOMIZE (number) command to control where the seed would start. If you would for instance write a program like this:

10 RANDOMIZE 1277
20 FOR F = 1 TO 10
30 PRINT RND
40 NEXT F

no matter how often you ran this, you would always get the same sequence of numbers.
The function is not truly random, the RND has some rhythm in it.

However, since most game programs are constantly looping, and are very much based on player reactions, there is a way to scramble this a bit. Just let the program select a random number for every loop while the player is for instance, idle. Making it simple, the above program could be like this:

10 RANDOMIZE 1277
20 FOR F = 1 TO 10
25 LET X = RND. IF INKEY$ <> " " THEN GO TO 25
30 PRINT RND
40 NEXT F

This leaves the initiative by the user, he will have to press the space bar to get his random number, and will due to the computer's speed in relation to human reflection, never get the same row of numbers.....

Quite interesting.
It was very interesting to carry out the flight trials at Rechlin with the Spitfire and the Hurricane. Both types are very simple to fly compared to our aircraft, and childishly easy to take-off and land. (Werner Mölders)

Offline Saintaw

  • Platinum Member
  • ******
  • Posts: 6692
      • My blog
Question for old time computer programers:
« Reply #16 on: February 03, 2003, 07:32:57 AM »
radioactive Decay Random Nrs page

I need to add that (In web programming) I haven't realy met a criteria where you need an absolute random yet. So far using a combination of 16 characters can get you a lonnnnnnnnnng way before you find two who match up.
 
« Last Edit: February 03, 2003, 07:37:16 AM by Saintaw »
Saw
Dirty, nasty furriner.