Author Topic: random image question.  (Read 8141 times)

0 Members and 1 Guest are viewing this topic.

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
random image question.
« on: January 04, 2003, 11:40:01 PM »
it seems that RANDOM_IMAGE and RANDOM_CAT_IMAGE shows same image:


yes, it does show different image if RANDOM_CAT_IMAGE picked an image from sub-category.
so if RANDOM_IMAGE chosed top level category to pick an image from and RANDOM_CAT_IMAGE chosed same top level category (not subcategory) then it  will show same image.
have anyone else notised it or I am just confused :? ?
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline Chris

  • 4images Moderator
  • 4images Guru
  • *****
  • Posts: 4.487
  • Did u ever stop to think and then forget to start?
    • View Profile
Well...
« Reply #1 on: January 05, 2003, 01:28:03 AM »
Random is random.  Therefore the mathematical laws of probability tell us that it is entirely possible for random image and random category image to occasionally pick the same image.  Fortunately I've completely forgotten what I learned in a college math course titled "Probability And Statistics" so I can't recall the formula that would let you compute how frequently this scenario would happen.  I say fortunately because I fondly remember calling the course "Probability & Sadistics" when I took it.

But perhaps I'm missing something.  Are you saying that they always pick the same image or that "random image" only picks from the top categories?  I haven't noticed any problems and yes, the images are occasionally the same.

Edit:  Yep.  I was missing something.  Whenever "random image" selects an image from a top-level category, it is ALWAYS the same as the "random category image".  Out of 35 tests, I'd say the probability of that happening on a truly random basis is nearly zero.

How odd.

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
random image question.
« Reply #2 on: January 05, 2003, 02:38:10 AM »
ok, I just checked it myself by opening new 4images and creating 4 categories with 1 sub-category in each and 4 images in each cat and sub-cat.

so, as far as I can see that RANDOM_CAT_IMAGE picks only images from it's category, and doesnt pick any images from its sub-category.
so, as far as RANDOM_IMAGE pick an image from any of categories not sub-category, it picks the same image as RANDOM_CAT_IMAGE in that category.

another words, if there are 10 categories with 1000 images in each and no sub-categories, then u can notice that RANDOM_IMAGE will have same picture as one of RANDOM_CAT_IMAGE.
that's probably something with rand. image cache I think.
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
random image question.
« Reply #3 on: March 09, 2003, 10:15:30 PM »
ok, just if anyone wondering...
the reason its doing this, becase of caching random images for EACH categopry.
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline Chris

  • 4images Moderator
  • 4images Guru
  • *****
  • Posts: 4.487
  • Did u ever stop to think and then forget to start?
    • View Profile
random image question.
« Reply #4 on: March 09, 2003, 11:49:51 PM »
Shortly after my last post I had noticed that on one or two occassions, random image selected an image that WASN'T one of the random category images.  Don't know why.  :?

Offline lemccoy

  • Jr. Member
  • **
  • Posts: 90
    • View Profile
    • DrunkIsland
Re: random image question.
« Reply #5 on: October 19, 2005, 05:02:28 PM »
Hi...this is an old thread but hopefully someone will notice! 

My random image is only coming from the category which you are in.  I have tried refreshing many times and it always selects a picture from the current category.  Did i change something by accident, and how would this be reverted?

Thanks for all your help.  Feel free to post pics to my site if ya like!

www.drunkisland.com

Offline lemccoy

  • Jr. Member
  • **
  • Posts: 90
    • View Profile
    • DrunkIsland
Re: random image question.
« Reply #6 on: October 19, 2005, 08:34:09 PM »
To answer my own question...just change in the constants.php (under includes):

// If you have a lot of images in your database,
// the random image function could make your programm slow.
// Try first to set "SHOW_RANDOM_CAT_IMAGE" to 0.
define('SHOW_RANDOM_IMAGE', 1);
define('SHOW_RANDOM_CAT_IMAGE', 0);