Server Help Forum Index Server Help
Community forums for Subgame, ASSS, and bots
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   StatisticsStatistics   RegisterRegister 
 ProfileProfile   Login to check your private messagesLogin to check your private messages   LoginLogin (SSL) 

Server Help | ASSS Wiki (0) | Shanky.com
need same random seed with push of a button

 
Post new topic   Reply to topic Printable version
 View previous topic  Player Position packet weapons question Post :: Post ifstream help  View next topic  
Author Message
Dymolex
Novice


Joined: Dec 02 2002
Posts: 25
Offline

PostPosted: Sat Jun 11, 2005 3:22 pm    Post subject: need same random seed with push of a button Reply to topic Reply with quote

I know that without Randomize Timer, the same sequence is received from Rnd(#) after starting a program. I want the same sequence repeated wiht a push of a button. I've tried Randomize 0, Randomize -1, Randomize 32767 in a button_down procedure but with no luck.
Back to top
View users profile Send private message Add User to Ignore List
CypherJF
I gargle nitroglycerin


Gender:Gender:Male
Joined: Aug 14 2003
Posts: 2582
Location: USA
Offline

PostPosted: Sat Jun 11, 2005 3:53 pm    Post subject: Reply to topic Reply with quote

Which programming language are you referring to?

Most of the time you need to seed the random number generator with a unique number - often times is the number of (milli)seconds a computer has been running, or since the Unix Epoch - so on and so forth.
_________________
Performance is often the art of cheating carefully. - James Gosling
Back to top
View users profile Send private message Add User to Ignore List
SamHughes
Server Help Squatter


Joined: Jun 30 2004
Posts: 251
Location: Greenwich
Offline

PostPosted: Sat Jun 11, 2005 4:00 pm    Post subject: Reply to topic Reply with quote

What random seed are you using? Suppose that current_time() is a function that returns the current time, and you're using that as a seed in

seed_random_number_generator(current_time())

Instead, just assign the seed to a variable:

repeated_seed := current_time()
seed_random_number_generator(repeated_seed)

Then later, for the same group of numbers, you can use

seed_random_number_generator(repeated_seed)

Naturally you will need to convert this into whatever crazy programming language you're using.

As for the push of a button, that's for you to figure out.
Back to top
View users profile Send private message Add User to Ignore List
Dymolex
Novice


Joined: Dec 02 2002
Posts: 25
Offline

PostPosted: Sat Jun 11, 2005 5:02 pm    Post subject: Reply to topic Reply with quote

i got it. had to get rnd from form_load and reuse it into Randomize in the button
Back to top
View users profile Send private message Add User to Ignore List
Dymolex
Novice


Joined: Dec 02 2002
Posts: 25
Offline

PostPosted: Sun Jun 12, 2005 7:06 pm    Post subject: Reply to topic Reply with quote

Dim seed As Long

Private Sub Form_Click()
ForeColor = vbWhite
Randomize seed
For v = 0 To 10
Print Rnd
Next
Print
End Sub

Private Sub Form_Load()
seed = Rnd
End Sub

why isn't this not working?
is putting the set of 10 in array the only way?
or do I have to change system clock ?
Back to top
View users profile Send private message Add User to Ignore List
CypherJF
I gargle nitroglycerin


Gender:Gender:Male
Joined: Aug 14 2003
Posts: 2582
Location: USA
Offline

PostPosted: Sun Jun 12, 2005 8:37 pm    Post subject: Reply to topic Reply with quote

To seed Vb6 you do a "Randomize" statement... see:

http://www.vbcity.com/pubs/article.asp?alias=randomnumbers


I think it may help.
Back to top
View users profile Send private message Add User to Ignore List
Display posts from previous:   
Post new topic   Reply to topic    Server Help Forum Index -> Bot Questions All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum
View online users | View Statistics | View Ignored List


Software by php BB © php BB Group
Server Load: 92 page(s) served in previous 5 minutes.

phpBB Created this page in 0.498543 seconds : 31 queries executed (95.3%): GZIP compression disabled