Show picture based on random percentage

Hi,
I want to show a certain picture based on a random percentage that I choose.
So for example, If I set the percentage at 4%, you have a 4% possibility that the picture will be shown when you visit my site.
But does anyone here know how I can program that calculation of the possibility?

Simple assign an integer value to each picture (called a weighting), then total them up. Then using an instance of java.util.Random generate a number between 0 and the total. Then just walk the list of pictures, reducing the result by the picture's weighting. When the result comes out <= 0 then that's the one.
One caution. Use the same instance of Random for each selection, don't create a new instance each time you use it.

Similar Messages

  • Will apple ever acknowledge the issue with premature failure of iphone5 batteries? A lot of people have problems with them dying at random percentages. Mine just died at 33% restarted it now I've been at 1% with non stop use for over an hour!

    My battery has been acting ridiculous on my phone. It shuts down at random percentages ranging from 60% down. I'll be using it with plenty of battery life left on the meter then I get the ring of death and it'll show a dead battery icon wanting charged. At this point I either have to plug it in or I have discovered I can hold down the home and lock button for a minute and it'll come back on still showing plenty of charge. I've read a lot of people have this issue. I've seen the recommendation of re calibrating the battery by fully draining and charging multiple times. I've done that with no results. I've also tried the recommendation of resetting the phone and doing a full restore which also doesn't work.
    I believe it's either a sub standard battery or possible a software or other hardware issue.
    Has anyone ever gotten apple to admit the Iphone5 battery has issue?
    I have 9 total apple devices in my household as far back as second gen iPod touch. All of my devices still hold power like new except my iPhone5.

    My battery has been acting ridiculous on my phone. It shuts down at random percentages ranging from 60% down. I'll be using it with plenty of battery life left on the meter then I get the ring of death and it'll show a dead battery icon wanting charged. At this point I either have to plug it in or I have discovered I can hold down the home and lock button for a minute and it'll come back on still showing plenty of charge. I've read a lot of people have this issue. I've seen the recommendation of re calibrating the battery by fully draining and charging multiple times. I've done that with no results. I've also tried the recommendation of resetting the phone and doing a full restore which also doesn't work.
    I believe it's either a sub standard battery or possible a software or other hardware issue.
    Has anyone ever gotten apple to admit the Iphone5 battery has issue?
    I have 9 total apple devices in my household as far back as second gen iPod touch. All of my devices still hold power like new except my iPhone5.

  • Need to show the Condition amount or percentage(KBETR) in display mode.

    Hi,
    i need to show the Condition amount or percentage(KBETR) in display mode for VA02 transaction based on the condition type. the KBETR in the table control. so how it will become in display mode?
    already i tried with this code.
    in MV45AFZZ form userexit_field_modification.
    case screen.
    when screen-name = 'KOMV-KBETR'.
    read table xkomv with key kschl = c_xr1(XR1).
    if sy-subrc = '0'.
    SCREEN-INPUT = '0'.
      endif.
    in debugging mode the condition is satisfying but not modifying the screen.
    can anyone help me . please it is urgent.

    Hi Praveen,
      See in Exit 'LV69AFZZ' and subroutine 'USEREXIT_FIELD_MODIFICATION',
    code should be like this
      if komv-kschl eq 'your condition type'.
        case screen-name.
          when 'KOMV-KBETR'.
              screen-input = 0.
        endcase.
      endif.
    For header level conditions you need to use "form userexit_field_modific_kopf"
    try it.
    i hope it will solve your problem.
    ENJOY SAP.

  • How to increase the salary based on the percentage value

    Hi All,
    Could you please let me know which API need to be used to implement the hike in salary based on the percentage value. And what all the parameters to be used.
    Appreciate your help...
    Thanks...

    Dear All,
    Any luck on this please?
    thanks..

  • HT4623 I was updating my i5 phone and now it shows picture of iTunes and plug what am I todo as I can't use the phone?

    I Was updating my i5 phone and it shows picture of iTunes and plug what am I to do?
    i Can't use my phone and shutting on and off won't help.

    Plug it into iTunes like it shows. It should tell you it has found a phone in recovery mode. You will need to restore the phone.

  • Aperture 3 Not Showing Pictures in Edit But Otherwise OK

    Hi,
    Aperture 3 is not showing pictures in the edit screen. Previews are ok. Moreover, when I zoom in in the edit window, pictures are showing correctly. Also they are shown a second after an adjustment is applied (and, actually, if you hold the slider you can see the picture the whole time). It exports fine.
    I've tried:
    repairing permissions;
    repairing database;
    rebuilding database;
    creating a new library and importing;
    manually repairing the library as per https://discussions.apple.com/message/11700059#11700059
    re-installing Aperture;
    reparing permissions system-wide.
    Nothing helps. I don't have the backup, obviously. System is Macbook Air 1.7 GHz i5, 4Gb.
    Could anyone, please, help?
    Thanks in advance,
    G.

    OK first off the procedure you referenced re: manually trying to rebuild a library is a last ditch, library is on fire, crashes the world procedure. It is never to be done as a first wave troubleshooting step and it is never to be done without a complete backup of the library. Hopefully that hasn;t added anything to the problem.
    Ok that's out of the way. You should start by removing the filter you have on the browser. It's most likely not causing this but there is no need for it and it's only adding a layer of complexity we don;t need now.
    What version of Aperture? If it is 3.2.3 (the latest from yesterday) did this start happening the? If it is not the latest you should upgrade.
    Does this happen with all images in the library or only some? What type of images RAW or JPG?
    If you create a new empty library and import a few images into it does the problem still happen? What if you make a new user and run Aperture as that user on a new library?
    When did the problem start? Was it working OK before with this library?
    Finally have you rebooted since this problem started?

  • Firefox is no longer showing pictures within icons

    Hi,
    My Firefox has stopped showing pictures within icons.
    If you can imagine an webpage that is used to send and receive email. This webpage has the "Reply" button. My reply button used to have a left arrow picture within the button however now there is nothing but a faint grey box. There is nothing that denotes this box as a button (reply or otherwise) . If I hover over the box the word "reply" will appear.
    All websites are like this...no "rich" web experience...just a white page ans faint grey boxes.
    I am operating Windows 7 Home edition.
    I uninstalled FF and reinstalled it and still no luck.

    Hi Cor-el,
    Thank you for your kind attempt at fixing this problem.
    I performed both of the fixed suggested above and still no pictures within the buttons. I closed FF and restarted and no joy.
    Can you PLEASE keep scratching your brain and think up something eles?
    As described...when looking at my email web page there used to be in the "reply" button a left pointing arrow and the "forward" button had a right facing arrow. Now there is nothing but a very faint box around where the button is (almost cannot see it). It is the same with other web pages as well.
    If I hover over the button the "Reply" cloud-ey thing pops up.
    Without the pictures in the icons it makes the email page almost useless.

  • FF will not show pictures in Ebay and Amazon BUT OK in IE8

    I have winXP pro on 3 machines all the same problem.
    I can have the same window open in both programmes.
    IE8 / IE7 shows pictures
    FF4 says pictures not available
    Problem with Halfords / Ebay / Amazon

    See:
    * http://kb.mozillazine.org/Images_or_animations_do_not_load
    You can use these steps to check if images are blocked:
    * Open the web page that has the images missing in a browser tab.
    * Click the website favicon ([[Site Identity Button]]) on the left end of the location bar.
    * Click the "More Information" button to open the "Page Info" window with the Security tab selected (also accessible via "Tools > Page Info").
    * Go to the <i>Media</i> tab of the "Tools > Page Info" window.
    * Select the first image link and scroll down through the list with the Down arrow key.
    * If an image in the list is grayed and there is a check-mark in the box "<i>Block Images from...</i>" then remove that mark to unblock the images from that domain.
    There are also extensions (Tools > Add-ons > Extensions) that can block images.

  • How to show picture in switch view ( Creative ZEN Vision:

    Hi
    I have Creative ZEN Vision:M, I try to use music folder of "Switch view" to show picture, right now only one folder is showing picture, the other folders are not able to display pictures, am I need to doing some kind of setup?
    Thanks.

    Just wanted to mention - I bought the IR Remote thinking to make the player useful without navigation keys. Now I feel like I wasted more money instead of shifting to some other player by some other company with better customer service.

  • Can I show pictures from my sx50 on my hd television.

    Does any one know the steps to show pictures on sx50 on a hd television?

    Just to lend some confidence to this, I do this all the time. But you will need a miniHDMI to standardHDMI, that's if you don't have a miniHDMI socket on TV. I don't, I have a standardHDMI socket. What's great is that I can control most of the Preview functions from the comfort of my sofa using my TV's remote!
    Grazie

  • Possible for slide show pictures to be bigger?

    Hey there,
    Got a photo web page made. I'd like for the slide show pictures to appear bigger than they currently are.
    Is it possible to change the size of them ?
    thanks,
    t

    Hey there,
    Got a photo web page made. I'd like for the slide show pictures to appear bigger than they currently are.
    Is it possible to change the size of them ?
    thanks,
    t

  • OSD package downloads fail after random percentage with error 80072EFE

    This is the most bizarre thing I've ever run into in SCCM and I've been banging my head against the wall for a week on it and it's making me want to switch back to WDS.
    The Problem
    The issue is when and OSD task sequence begins to download an image from the DP. Sometimes the image is downloaded without problems and sometimes the download just fails a random percentage multiple times before it is successful. For example:
    Sometimes the download fails a 9%, it'll retry from the same or different DP and fail at a different percentage, then fail again, then it'll finally download the package from a DP it originally failed from.
    Example Error
    List of files to be downloaded ApplyOperatingSystem
    3/1/2013 10:34:22 AM 1456 (0x05B0)
      File: http://XXXX2001.XXXX.XXXX:80/SMS_DP_SMSPKG$/ISD0000E/sccm?/Windows.7.x64.Thin.wim
    ApplyOperatingSystem 3/1/2013 10:34:22 AM
    1456 (0x05B0)
    GetDirectoryListing() successfully completed
    ApplyOperatingSystem 3/1/2013 10:34:22 AM
    1456 (0x05B0)
    401 - Authentication failure on request with anonymous access, retrying with context credentials.
    ApplyOperatingSystem 3/1/2013 10:34:22 AM
    1456 (0x05B0)
    401 - Authentication failure on request with context credentials, retrying with supplied credentials.
    ApplyOperatingSystem 3/1/2013 10:34:22 AM
    1456 (0x05B0)
    WinHttpReadData(hRequest, (LPVOID)pszOutBuffer, dwSize, &dwRead), HRESULT=80072efe (e:\nts_sccm_release\sms\framework\tscore\downloadcontent.cpp,1014)
    ApplyOperatingSystem 3/1/2013 10:35:37 AM
    1456 (0x05B0)
    ReadDataAndWriteToFile() failed with 0x80072efe when downloading 9% of file C:\_SMSTaskSequence\Packages\ISD0000E\Windows.7.x64.Thin.wim
    ApplyOperatingSystem 3/1/2013 10:35:37 AM
    1456 (0x05B0)
    ReadDataAndWriteToFile (hRequest, ullFileSize, hFile, pszDestination, ulTotalSizeRequired, ulDownLoaded), HRESULT=80072efe (e:\nts_sccm_release\sms\framework\tscore\downloadcontent.cpp,1573)
    ApplyOperatingSystem 3/1/2013 10:35:37 AM
    1456 (0x05B0)
    DownloadFile failed. 80072efe. ApplyOperatingSystem
    3/1/2013 10:35:37 AM 1456 (0x05B0)
    DownloadFile (hSession, hConnect, sSourceFile.c_str(), sDestinationFile.c_str(), ulTotalSizeRequired, ulDownLoaded, LastGoodCredentialsType, bUseSSL), HRESULT=80072efe (e:\nts_sccm_release\sms\framework\tscore\downloadcontent.cpp,1648)
    ApplyOperatingSystem 3/1/2013 10:35:37 AM
    1456 (0x05B0)
    Error downloading file from http://XXXX2001XXXXXX.XXX:80/SMS_DP_SMSPKG$/ISD0000E/sccm?/Windows.7.x64.Thin.wim to C:\_SMSTaskSequence\Packages\ISD0000E\Windows.7.x64.Thin.wim
    ApplyOperatingSystem
    3/1/2013 10:35:37 AM 1456 (0x05B0)
    DownloadFiles failed. 80072efe. ApplyOperatingSystem
    3/1/2013 10:35:37 AM 1456 (0x05B0)
    DownloadFiles (setDirs, setFiles, sDestination.c_str(), bUseSSL), HRESULT=80072efe (e:\nts_sccm_release\sms\framework\tscore\resolvesource.cpp,2523)
    ApplyOperatingSystem 3/1/2013 10:35:37 AM
    1456 (0x05B0)
    Retrying download... ApplyOperatingSystem
    3/1/2013 10:35:37 AM 1456 (0x05B0)
    What I've tested
    I don't think it's the DP because I have three DPs and this error happens with all the DPs
    I don't think it's the package because it happens to all OS packages and I've tried updating them, deleting, and recreating them
    I don't think it's the machines or NICs because I've tested it on multiple machines that all have different networks cards in different locations
    I've run out of ideas and I'm desperate for help. I'm starting to lean towards it possibly being a network issue? Any advice would be greatly appreciated. Logs to check, things to test, anything.
    Please help!
     

    Hi,
    Did you ever find a resolution for this issue? I am also getting the same problem.
    Thanks,
    Ross
    After doing much more testing I found some interesting things and possibly a solution. It turns out we weren't having this issue at other sites over our WANs when pulling images from the server in our NOC, only machines on site with the NOC. I had the network
    guys take a closer look at the logs on the core switch and there were a few devices causing excessive CRC/Alignment errors. These devices were unplugged and everything seems to be working fine now. They didn't do any configuration changes that I'm aware of.

  • My iPhone 4s is stuck after attempting to download the latest update several hours ago. The screen shows picture to connect charger cord to iTunes however, when i do, iTunes is not detecting

    My iPhone 4s is stuck after attempting to download the latest update several hours ago. The screen shows picture to connect charger cord to iTunes however, when i do, iTunes is not detecting the phone when I plug it into my lap top. that has never been a problem before now. please help? I have been with out a phone for hours and I am losing a lot of business.

  • My downloaded TV Shows are played in random order, how do i fix this?

    My downloaded TV Shows are played in random order, how do i fix this?
    Basically I have 10 complete seasons of Friends and I often watch it again and again but at the moment my itunes play my tv shows in random order!
    Please help!

    First, make sure you are running the latest version of iTunes on your computer. Update your Apple TV if you are using this as well.
    Second, if the updates don't resolve it, you'll need to use 'Get Info' on each TV episode. Make sure the media type is 'TV Show'. Then make sure that the epside number and season information is entered properly.
    That should fix your issue.

  • Showing Picture At Selection screen.

    Hi,
    I want to show Picture from my PC hard drive at selection screen of abap program ( SAP repo. mime type i know but i want specially from my hard drive on pc ).
    how it can be possible ? if possible give code.
    Thanks,

    Hi
    if you have a simple report " selection screen of abap program 1000  ".... I think it´s not possible....
    but.
    If you have a "handmade" dynpro 0100 > try to use a HTML Container ( its start a Internet Explorer .. ) and shows you the gif, jpeg..
    But it´s easier to use a external/internal UI adress ( Webspace ) for the picture, as the dektop space fg
    Best reg Robert

Maybe you are looking for

  • Dynamic images in a Servlet with WL6.1

    Hi,           I try to create a BufferedImage in a Servlet:           BufferedImage img = new BufferedImage(320,200,           BufferedImage.TYPE_INT_RGB);           I get an UnsatisfiedLinkError to the log. The servlet works fine on           Tomcat

  • Acrobat 9 Standard- missing "Redax" menu

    Hi, I have a weird problem that I hope someone on here can help me with.  Recently started working in a law firm as their IT guy.  Have many users of Acrobat 9 Standard, but only a handful of them have the "Redax" menu on the toolbar.  As I didn't pe

  • Spotlight doesn't find files after Time Machine re-load

    So I just got a new macbook pro and transferred everything from my old laptop onto it using Time Machine, which worked amazingly ... only weird thing now is when i search in the Finder Search bar or in Spotlight, it doesn't find any files that were o

  • Remove "Edit" from contacts page

    Hi All, I have attached "Contacts" Page to my room template , created lay out set for user not to add contacts and folder ie removed new contact and new folder. but on right corner of the page , edit button still there for user contacts page  - where

  • Extra Audio Frames When Exporting Video

    Does anybody have the issue of extra audio frames being added when exporting a video. Every time I export, the audio adds like a 2 second handle. Very strange.