• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Random is really Random ?!?

Status
Not open for further replies.
Level 18
Joined
Jun 2, 2009
Messages
1,205
  • test isyan
    • Events
      • Time - Turn expires
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Random 6 units from (Units of type Circle)) and do (Actions)
        • Loop - Actions
          • Unit - Create 3 Rebel for Player 12 (Brown) at (Position of (Picked unit)) facing Default building facing degrees
When the Turn timer expires, rebels spawns at the same locations everytime in the game ? What can i do ? we already tested 5 or 6 times and EVERYTIME rebels spawns at the same locations

how can i solve this problem ?
 
Level 14
Joined
Apr 20, 2009
Messages
1,543
First off when working with computers, random can never completely be random.

Second off, I think you might want to untick Use Fixed Random Seeds under:
File -> Preferences -> Test Map
 
Level 18
Joined
Jun 2, 2009
Messages
1,205
Fixed Random Seed always turn off in my editor and as i said i'm tested this trigger in the game but everytime rebels spawns at the same locations

what can i do ? i just want to select random x units from (unist of type x) and create rebels from the picked x location
 
Level 14
Joined
Apr 20, 2009
Messages
1,543
EDIT: scrap that.

You want to pick a amount of random units from a unit type and create rebels on the positions of the picked units?
What exactly is currently happening?
Are you saying the exact same units are picked over and over again? (this should be fixed by not using fixed seeds)

Have you tried testing this in multiplayer?

EDIT: I just did a test in a new map with this trigger (just keep restarting, you'll see):
  • Untitled Trigger 002
    • Events
      • Time - Elapsed game time is 0.00 seconds
    • Conditions
    • Actions
      • Custom script: call bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Random 6 units from (Units of type Peasant)) and do (Actions)
        • Loop - Actions
          • set tempLoc = (Position of (Picked unit))
          • Unit - Create 1 Footman for Player 1 (Red) at tempLoc facing Default building facing (270.0) degrees
          • Custom script: call RemoveLocation(udg_tempLoc)
I placed 15 peasants in the editor.
This works perfectly fine except for the fact that it's not really that random...
(Remember to fix leaks, like I did in this trigger)

In other words: the trigger you just posted can not go wrong, there must be some other trigger interfering or something else going on.
 
Last edited:
Level 18
Joined
Jun 2, 2009
Messages
1,205
yes as i said "we" tested that means we tested many times in multiplayer but nothing changed now i'll try your solution

edit: what's the call bj_wantDestroyGroup = true is that a variable like as tempLoc ? JassHelper gives me the error
 
Level 14
Joined
Apr 20, 2009
Messages
1,543
My solution is just a test of your trigger in a new map. Your trigger works perfectly fine (you do need to clean a leak here and there) but other then that, this trigger can not go wrong as it works perfectly in a new map.
The only thing causing your issue is either other triggers or the fixed seeds being used or there is something else going on. But it sure as hell is not this trigger.


If it's simply not random enough, implement your own randomization of locations instead of residing on blizzard poor way of coding randomization with BJ natives.
 
Level 18
Joined
Jun 2, 2009
Messages
1,205
test isyan
  • Events
    • Time - Turn expires
    • Player - Player 1 (Red) skips a cinematic sequence
    • Conditions
    • Actions
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Random 6 units from (Units of type Cember)) and do (Actions)
        • Loop - Actions
          • Set TempLoc = (Position of (Picked unit))
          • Unit - Create 3 Rebel for Player 12 (Brown) at TempLoc facing Default building facing degrees
          • Custom script: call RemoveLocation(udg_TempLoc)
but this time this trigger won't work :)
 
Level 14
Joined
Apr 20, 2009
Messages
1,543
Please tell me that in this map whenever you press escape the units are not created at random peasant positions?
I don't see how this is different from what you've shown me so far. As I said: If it's not (which I'm really sure about), your problem is not this trigger but something else.
 

Attachments

  • proof.w3x
    146 KB · Views: 48
Level 19
Joined
Aug 8, 2007
Messages
2,765
Note that Unit - Create #

will not create them all at different points but all 3 at the same random point
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
It should have 2 Unit Group;
  • Actions
    • Set TempUnitGroup = (Units of type Cember)
    • Set TempUnitGroup2 = (Random 6 units from TempUnitGroup)
    • Unit Group - Pick every unit in TempUnitGroup2 and do (Actions)
      • Loop - Actions
        • Set TempLoc = (Position of (Picked unit))
        • Unit - Create 3 Peasant for Player 12 (Brown) at TempLoc facing Default building facing degrees
        • Custom script: call RemoveLocation(udg_TempLoc)
    • Custom script: call DestroyGroup(udg_TempUnitGroup)
    • Custom script: call DestroyGroup(udg_TempUnitGroup2)
Because the first function to call the Random N Units leak itself as a Unit Group, therefore you should set them both to a TempUnitGroup variable for the leaks to be cleaned completely.

This case is same with OriginLoc and OffsetLoc issues.

This leaks because it calls ((Position of (Triggering unit))
  • Set TempLoc = ((Position of (Triggering unit)) offset by 256.00 towards 0.00 degrees)
This also leaks;
  • Actions
    • Set TempLoc = (Position of (Triggering unit))
    • Set TempLoc = (TempLoc offset by 256.00 towards 0.00 degrees)
If you destroy TempLoc, only the OffsetLoc would be destroyed and would leave the OriginLoc, floating somewhere in the game eating up memory.

This won't leak;
  • Actions
    • Set TempLoc = (Position of (Triggering unit))
    • Set TempLoc2 = (TempLoc offset by 256.00 towards 0.00 degrees)
As if you destroyed them both, both are properly destroyed because each of them is referencing to a different location memory.
 
Level 14
Joined
Apr 20, 2009
Messages
1,543
Because the first function to call the Random N Units leak itself as a Unit Group, therefore you should set them both to a TempUnitGroup variable for the leaks to be cleaned completely.

Oh yeah, stupid me I forgot that those are 2 unit groups. My mistake didn't see them.

This case is same with OriginLoc and OffsetLoc issues.

This also leaks;
  • Actions
    • Set TempLoc = (Position of (Triggering unit))
    • Set TempLoc = (TempLoc offset by 256.00 towards 0.00 degrees)
If you destroy TempLoc, only the OffsetLoc would be destroyed and would leave the OriginLoc, floating somewhere in the game eating up memory.

This won't leak;
  • Actions
    • Set TempLoc = (Position of (Triggering unit))
    • Set TempLoc2 = (TempLoc offset by 256.00 towards 0.00 degrees)
As if you destroyed them both, both are properly destroyed because each of them is referencing to a different location memory.

I see that this is general information that doesn't have to do much with the trigger itself? Unless the OP wants to add an offset ofcourse.

Not that I mind at all, it's good to give general information.


And what's with this new create link that we're having ?
Someone report to Ralle ASAP.

Usually this kind of problem is related to spyware. I'm not sure if everyone is having this problem currently or if it's only installed on a clients computer (I think not since I'm rather sure that I'm not having any spyware over here). In this case something might have infected the server of hiveworkshop.

I just did a DNS lookup on www.create.net and a mailserver lookup on the ip address returned from that DNS lookup.
This site has been blacklisted 2 times before:
http://www.dnswatch.info/dns/rbl-lookup?host=194.187.56.50&submit=RBL+Lookup

I guess the server is infected.
If you start recieving advertisement e-mails you might want to temporarely remove your e-mail address from hiveworkshop untill this issue is fixed.
 
Level 14
Joined
Apr 20, 2009
Messages
1,543
This site was blacklisted by other websites before for sending spam e-mail messages towards e-mail accounts
(this was reported on the mail server, not the domain).
So it's probably better to assume that it's adding spam to webpages.
(We'll find out sooner or later if our inbox will be spammed too).
This is purely because the creator of the infection wants to manifest traffic for his/her website in order to gain money.
The more people that visit the link the more money he can make of his/her websites traffic.

In particular it seems to be created in such a way that it doesn't look like spam:
create
create
create
create
create

Some site statistics: http://www.alexa.com/siteinfo/www.create.net
I think Ralle just needs to use a webmaster tool to remove these backlinks.
Or contact his service provider about this (unless he has his own server).
 
Last edited:
Level 14
Joined
Apr 20, 2009
Messages
1,543
He can prove the psuedo code creates random numbers, but eventually after enough test it's not random.
Why do you think casino's make profit?
Because the law of probability shows that it's eventually not as random as it seems.
 
He can prove the psuedo code creates random numbers, but eventually after enough test it's not random.
Why do you think casino's make profit?
Because the law of probability shows that it's eventually not so random as it seems.
Numbers like those on roulette or dice are random and can't be predicted in future.

Pseudo numbers are random numbers, but we can, only if we know seed and formula predict them in future.

Those numbers have all basic random numbers properties.

Random number generation random number generator must meet the following properties:
- 1st need to have a great cycle length (periodicity, because they will start to repeat after a while, this is bad in some cases like when we need random numbers to simulate some service with clients etc etc)
- 2nd need to generate random numbers that are repeatable (it should generate numbers like 1 or 2 many times, not just once)
- 3rd You do not need to be deviant (distortion)
- 4th should be fast and not require a lot of computer memory.
- 5th need to create random numbers that pass all tests of statistical randomness (independence sequence, there shouldn't be a correlation between the i-th and (i + k)-the cause (k = 1,2,3, ... n)
- 6th should be uniformly distributed in a given interval.

I study this on university, we use program GPSS to handle some real life situations that can't be solved using math functions and standard calculations.

I can translate some of this from my scripts, but if interested google it yourself.
 
Level 14
Joined
Apr 20, 2009
Messages
1,543
Numbers like those on roulette or dice are random and can't be predicted in future.

What is your definition of random?
In terms of predictability you are correct, but not when it comes to patterns...

When throwing 2 dice and counting the total, we can say that a sum of 7 will randomly occur twice as often as 4.
Due to this probability we can safely assume that it's less random then it supposedly seems.

This same thing counts for equations because the further we test it, the more patterns will start to appear.
And those patterns could in fact contribute into denying its randomness alltogether.

Pseudo numbers are random numbers, but we can, only if we know seed and formula predict them in future.

You just admitted that it's not random since we can predict them.
Ofcourse only if we know the source, but that is regardless of whether it is in fact random.

Whether it is open source or not is a different matter.

Those numbers have all basic random numbers properties.

Random number generation random number generator must meet the following properties:
- 1st need to have a great cycle length (periodicity, because they will start to repeat after a while, this is bad in some cases like when we need random numbers to simulate some service with clients etc etc)
- 2nd need to generate random numbers that are repeatable (it should generate numbers like 1 or 2 many times, not just once)
- 3rd You do not need to be deviant (distortion)
- 4th should be fast and not require a lot of computer memory.
- 5th need to create random numbers that pass all tests of statistical randomness (independence sequence, there shouldn't be a correlation between the i-th and (i + k)-the cause (k = 1,2,3, ... n)
- 6th should be uniformly distributed in a given interval.

I study this on university, we use program GPSS to handle some real life situations that can't be solved using math functions and standard calculations.

I can translate some of this from my scripts, but if interested google it yourself.

I am quite interested about the subject matter and I will probably look into it.
It's probably still way over my head, but I am keen to learn.

I still don't think it's possible to create completely random numbers with computers (yet) since they are after all based on logic.
It all comes down to bits eventually.

With quantum computers however, this might be a completely different case since bits are both 1 and 0 simultaniously.
I can't wait till this immense calculation power is on it's full potential by the way.

My point being: time will tell.
 
Last edited:
Level 33
Joined
Mar 27, 2008
Messages
8,035
Can you guys stop arguing about it and if you guys really give a damn about this, flame war on PM, not here - on solved thread.

Also,

I see that this is general information that doesn't have to do much with the trigger itself? Unless the OP wants to add an offset ofcourse.

Not that I mind at all, it's good to give general information.
I'm giving example as to relate with the 2 Unit Group situation with the 2 Point situation.
 
Status
Not open for further replies.
Top