1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Sort-of-random image generator?

Discussion in 'General Programming Chat' started by Virre, Aug 27, 2010.

Thread Status:
Not open for further replies.
  1. Virre

    Virre Level IV

    Joined:
    Nov 30, 2006
    Messages:
    1,181
    Likes Received:
    63
    Location:
    Stockholm
    Say that I have 1000 pictures and they're divided into 15 categories.
    Would it be possible to make a random generator program that give these categories different values, so that a first image is chosen at random as well as how many images will show in a sequence, but that depending on the value of the category that the image is in, the following images are chosen at random from specific categories?

    Example:
    Program starts up and generates how mnany pictures will show and the starting picture is randomly chosen the be a picture from the 7th category (value=7). Following image will be chosen from category 9, following that will be a category 3 picture etc. until the right number of pictures have been displayed.
     
  2. Lightning

    Lightning Administrator
    Staff Member

    Joined:
    Nov 8, 2008
    Messages:
    3,021
    Likes Received:
    195
    Gender:
    Male
    Location:
    Florida, USA
    Well, yeah it would be possible to make one o_O

    Would you like someone to make it or for you to have some help on it? If you just name every image in the folder {1, 2, 3...} then you could just have the program generate two random numbers, one for the category, one for the images.
     
  3. Virre

    Virre Level IV

    Joined:
    Nov 30, 2006
    Messages:
    1,181
    Likes Received:
    63
    Location:
    Stockholm
    I'd like to try and give it a shot myself, but I needsome guidance since I haven't tried coding earlier. So tutorials and tipsare appreciated =)

    Yeah, generating the first two numbers wouldn't be any problem, it's about having the images following the first that I'm more confused about. If an image from folder 2 is chosen, and the followed image must be an image from folder 4, how would I go about that? Also, to have the last image in the sequence to be from a certain folder or sub-folder.
     
  4. Lightning

    Lightning Administrator
    Staff Member

    Joined:
    Nov 8, 2008
    Messages:
    3,021
    Likes Received:
    195
    Gender:
    Male
    Location:
    Florida, USA
    Is there some sort of pattern in it? Like +2 or something?

    Oh, and what language are you coding this in? Psst, PM me :D
     
  5. Virre

    Virre Level IV

    Joined:
    Nov 30, 2006
    Messages:
    1,181
    Likes Received:
    63
    Location:
    Stockholm
    No pattern, just a randomly chosen starting point and an end point chosen from a subfolder.

    Also, pm'd ^^
     
  6. Zer0

    Zer0 Level IV

    Joined:
    Mar 2, 2008
    Messages:
    3,037
    Likes Received:
    180
    Location:
    Home sweet home
    Shouldn't be too hard with PHP
     
  7. HeartLess

    HeartLess Newbie

    Joined:
    Aug 31, 2010
    Messages:
    13
    Likes Received:
    0
    if you are referring to php, it should be simple...

    i don't understand what you mean by the categories though...

    can't you just use

    psuedocode:
    $rand= rand(1,???)
    <img src = '/images/".$rand.".gif'>
    blah blah blah
     
  8. btimage

    btimage Newbie

    Joined:
    May 31, 2013
    Messages:
    2
    Likes Received:
    0
    it sounds hard to generate images c#. especially divide into so many categories. and the image should be displayed in a certain sequence. hope it get done quickly.
     
  9. Lizard

    Lizard Level II

    Joined:
    Mar 22, 2013
    Messages:
    256
    Likes Received:
    8
    Its not really generating if I read the first message correctly.

    Its more like picking a random sequence of images out of a database according to catagories - Not that hard to write out in c#
     
  10. chelsea1

    chelsea1 Level IV

    Joined:
    Nov 26, 2006
    Messages:
    2,538
    Likes Received:
    31
    Location:
    London
    This topic is almost 3 years old.

    -Locked-
     
Thread Status:
Not open for further replies.