Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.

a=RND(1)*6+1 (dopuna do 15 karaktera)

[es] :: Visual Basic 6 :: a=RND(1)*6+1 (dopuna do 15 karaktera)

[ Pregleda: 2263 | Odgovora: 3 ] > FB > Twit

Postavi temu Odgovori

Autor

Pretraga teme: Traži
Markiranje Štampanje RSS

djordje
Novi Sad

Član broj: 3704
Poruke: 1725
*.vdial.verat.net



+3 Profil

icon a=RND(1)*6+1 (dopuna do 15 karaktera)28.07.2004. u 15:55 - pre 240 meseci


Code:
a=RND(1)*6+1


ovo bi trebalo da dodeli promenjlivoj a neku slučajnu vrednost između 1 i 6.
Zašto ova funkcija uvek generiše iste brojeve svaki put kada pokrenem aplikaciju? Svaki put kada pokrenem program dobijam niz npr: 1,4,4,2...
Problem sam rešio na jedan grub način, preko tajmera, a zanima me ima li načina da se to reši na kulturan (kratak) način.
 
Odgovor na temu

mladenovicz
Zeljko Mladenovic
Xoran Technologies, Inc., Ann Arbor, MI,
USA / Software Engineer
Ann Arbor, MI, USA

Član broj: 6598
Poruke: 2065
*.bg.wifi.vline.verat.net.

Jabber: mladenovicz@elitesecurity.org
ICQ: 95144142
Sajt: yubc.net/~mz


Profil

icon Re: a=RND(1)*6+1 (dopuna do 15 karaktera)28.07.2004. u 16:14 - pre 240 meseci
dodaj u kod ovo:

Code:

Randomize Timer

 
Odgovor na temu

djordje
Novi Sad

Član broj: 3704
Poruke: 1725
*.vdial.verat.net



+3 Profil

icon Re: a=RND(1)*6+1 (dopuna do 15 karaktera)09.08.2004. u 22:55 - pre 239 meseci
Sta se postize time (malo teorije nikad nije na odmet)
 
Odgovor na temu

mladenovicz
Zeljko Mladenovic
Xoran Technologies, Inc., Ann Arbor, MI,
USA / Software Engineer
Ann Arbor, MI, USA

Član broj: 6598
Poruke: 2065
*.bg.wifi.vline.verat.net.

Jabber: mladenovicz@elitesecurity.org
ICQ: 95144142
Sajt: yubc.net/~mz


Profil

icon Re: a=RND(1)*6+1 (dopuna do 15 karaktera)10.08.2004. u 09:37 - pre 239 meseci
Citat:
MSDN:

Randomize Statement

Initializes the random-number generator.

Syntax

Randomize [number]

The optional number argument is a Variant or any valid numeric expression.

Remarks

Randomize uses number to initialize the Rnd function's random-number generator, giving it a new seed value. If you omit number, the value returned by the system timer is used as the new seed value.

If Randomize is not used, the Rnd function (with no arguments) uses the same number as a seed the first time it is called, and thereafter uses the last generated number as a seed value.

Note To repeat sequences of random numbers, call Rnd with a negative argument immediately before using Randomize with a numeric argument. Using Randomize with the same value for number does not repeat the previous sequence.


 
Odgovor na temu

[es] :: Visual Basic 6 :: a=RND(1)*6+1 (dopuna do 15 karaktera)

[ Pregleda: 2263 | Odgovora: 3 ] > FB > Twit

Postavi temu Odgovori

Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.