Author Topic: Rnd function  (Read 28360 times)

Offline Botsareus

  • Society makes it all backwards - there is a good reason for that
  • Bot God
  • *****
  • Posts: 4483
    • View Profile
Rnd function
« Reply #15 on: February 26, 2005, 04:14:57 PM »
The Stuff I do: #1 I generate about 225000 rnd calls a second. And #2 if you simply use "timer" it will repeat again the same if the program is run on the same exact instant. It takes maybe 1 second for the program to reload so for every new load there is maybe a 1/1000 chance that the program is going to use an old randomize sequence. But gess what with my new code I fixed bouth of these problems.

Offline Botsareus

  • Society makes it all backwards - there is a good reason for that
  • Bot God
  • *****
  • Posts: 4483
    • View Profile
Rnd function
« Reply #16 on: February 26, 2005, 04:17:33 PM »
Good News is that it did improve the work of my program. Have not seen any Ms-Dos yet though.

Offline MightyPenguin

  • Moderator
  • Bot Destroyer
  • *****
  • Posts: 189
    • View Profile
Rnd function
« Reply #17 on: February 26, 2005, 04:25:19 PM »
4.5382061861071679164704351389191e+37 / 225000 = 2.016980527158741296209082283964e+32

 :D

Offline Botsareus

  • Society makes it all backwards - there is a good reason for that
  • Bot God
  • *****
  • Posts: 4483
    • View Profile
Rnd function
« Reply #18 on: February 26, 2005, 04:29:33 PM »
The Point is it does work better. Lets see what Num has to say....

Yea, with the math you did MP, it does seem perfect. But its not.
« Last Edit: February 26, 2005, 04:30:00 PM by Botsareus »

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
Rnd function
« Reply #19 on: February 26, 2005, 11:13:45 PM »
How do you run two instances of the program in the same instant?
« Last Edit: February 26, 2005, 11:14:05 PM by Numsgil »

Offline MightyPenguin

  • Moderator
  • Bot Destroyer
  • *****
  • Posts: 189
    • View Profile
Rnd function
« Reply #20 on: February 27, 2005, 06:57:40 AM »
Two processors?

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
Rnd function
« Reply #21 on: February 27, 2005, 08:18:56 AM »
I can't find any information on the VB random number generator, or how good it is, or what its period is.

For one program I needed to generate at least 200 billion random numbers, so there are times when you need a good random number generator.

DB probably isn't there yet, but I love talking about random numbers!

Offline Botsareus

  • Society makes it all backwards - there is a good reason for that
  • Bot God
  • *****
  • Posts: 4483
    • View Profile
Rnd function
« Reply #22 on: February 27, 2005, 11:03:15 AM »
I was Basing it on the msdn help for the rnd function.
I also did a timed test too see aprox. the number of rnd calls in two seconds.
/ 2 x 45 running smexe: came out to 225000 calls per second.


Forgive me if I messed this one up but somthing like:

Form_load()
show
Do
j = j + 1
if (timer) /2 = (timer) \2 then msgbox j 'forget about the fact thats it has to do the
'loop code and the j++ code ...  ;)
Loop
End Sub
« Last Edit: February 27, 2005, 11:06:35 AM by Botsareus »

Offline Botsareus

  • Society makes it all backwards - there is a good reason for that
  • Bot God
  • *****
  • Posts: 4483
    • View Profile
Rnd function
« Reply #23 on: April 02, 2005, 04:13:42 PM »
OK gess what the rnd function DOES NOT WORK LIKE THIS

newrndnumberinlist = rnd(-oldrandomnumber)

<>

newrndnumberinlist = rnd

The Truth is no one has a clue were vb gets its next random number in stack from:

newrndnumberinlist = rnd(-???????)


Ok here is the second thing that people should look out for:

lets say you have a number that changes in low range: 0.001 , 0.002 , 0.003....

DO NOT ADD ANY HIGH RANGE NUMBERs like 700000  TO IT EX:

70000.001 , 70000.002 , 7000 0.003 ...

IT WILL LOSE SENSATIVITY TO LOWER RANGE CHANGE

rnd(-(rnd+70000)) <------ not so good idea.

Finaly , If you want to make the random function more powerfull you have first run the list:

For I = 0 to 1000000
thelist(I) = rnd
next

into memory,

Then combine it later with your own random numbers:

yourownrandomnumber = rnd(-cpuflux)

t = t +1

'COMBINE ONLY USING ATN() FUNCTION , I use getang as a custom atn using function

result = rnd(-(getang( rnd(-yourownrandomnumber) -0.5  , rnd(-thelist(t)) -0.5 )/360)
« Last Edit: April 02, 2005, 04:20:20 PM by Botsareus »

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
Rnd function
« Reply #24 on: October 14, 2005, 09:57:42 PM »
I'm sticky-ing this thread because every two or three months I go hunting for that incredibly book with the chapters I posted near the beginning of the thread, and have to hunt this damn thign down.

Offline Zelos

  • Bot Overlord
  • ****
  • Posts: 707
    • View Profile
Rnd function
« Reply #25 on: October 23, 2005, 08:24:12 AM »
I know how to create a perfect randomizer, give a radiation detector, some radioactive material, connect the detecter to the computer and create random or logical things it will become random cause the radioactive material decay is completly random ^_^ thats the perfect randomizer.
When I have the eclipse cannon under my control there is nothing that can stop me from ruling the world. And I wont stop there. I will never stop conquering worlds through the universe. All the worlds in the universe will belong to me. All the species in on them will be my slaves. THE ENIRE UNIVERSE WILL BELONG TO ME AND EVERYTHING IN IT :evil: AND THERE IS NOTHING ANYONE OF you CAN DO TO STOP ME. HAHAHAHAHAHAHAHA

Offline Griz

  • Bot Overlord
  • ****
  • Posts: 608
    • View Profile
Rnd function
« Reply #26 on: October 23, 2005, 08:58:45 AM »
Quote
I know how to create a perfect randomizer, give a radiation detector, some radioactive material, connect the detecter to the computer and create random or logical things it will become random cause the radioactive material decay is completly random ^_^ thats the perfect randomizer.
I am not in disagreement my friend ...
I think that is as close as one can come.
but even if what you say is so ...
how would one ever be able to verify that? ;)
to catch any 'mistake' it made ...
or to verify it did not ...
you would have to employ a system of observation
that is more random than the one you are observing.
it's like trying to see the eye with the eye ...
or to understand the mind using the mind.
as long as there is a subject/object split ...
there exists this division/duality ...
a part that is observer ...
which is separate from the observed.
so our very looking/questioning ...
alters what we find.
is it not so?
« Last Edit: October 23, 2005, 09:05:37 AM by Griz »
不知
~griz~
[/color]
   "The selection of Random Numbers is too important to be left to Chance"
The Mooj  a friend to all humanity
[/color]

Offline Griz

  • Bot Overlord
  • ****
  • Posts: 608
    • View Profile
Rnd function
« Reply #27 on: October 23, 2005, 09:13:06 AM »
Quote
I'm sticky-ing this thread because every two or three months I go hunting for that incredibly book with the chapters I posted near the beginning of the thread, and have to hunt this damn thign down.
yeah. thanks Num ... a good read.
不知
~griz~
[/color]
   "The selection of Random Numbers is too important to be left to Chance"
The Mooj  a friend to all humanity
[/color]

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
Rnd function
« Reply #28 on: October 23, 2005, 02:43:45 PM »
You can find the whole book here.

There are some outright amazing stuff in there beyond even just random numbers.  Some of the math I've started learning in my 400 level math courses, to give you an idea of the difficulty...

Offline Zelos

  • Bot Overlord
  • ****
  • Posts: 707
    • View Profile
Rnd function
« Reply #29 on: October 23, 2005, 02:57:33 PM »
I tried the random in vb and it worx very well if you use both date and time, cause each second and hour and day is different so it wont repeat for a very long time and then its very random
When I have the eclipse cannon under my control there is nothing that can stop me from ruling the world. And I wont stop there. I will never stop conquering worlds through the universe. All the worlds in the universe will belong to me. All the species in on them will be my slaves. THE ENIRE UNIVERSE WILL BELONG TO ME AND EVERYTHING IN IT :evil: AND THERE IS NOTHING ANYONE OF you CAN DO TO STOP ME. HAHAHAHAHAHAHAHA