Applescript: how to record and return how many times a number appears when using a random number generator

I create one rng and repeat another rng that many times like so:
set x to (random number from 0 to 250)
repeat x times
  set rn to (random number from 1 to 10)
end repeat
now what i would like to do is record and return how many times 'rn' comes up with one particular number. Any ideas?

You could set up a list and increment the contents of a particular index each time it comes up, for example:
set how_many to {0, 0, 0, 0, 0, 0, 0, 0, 0, 0} -- 1 thru 10
set x to (random number from 0 to 250)
repeat x times
  set rn to (random number from 1 to 10)
  set item rn of how_many to (item rn of how_many) + 1
end repeat
return how_many

Similar Messages

  • Is it possible to see how many times a component has been used in our websites?

    Hi,
    we currently have 3 websites running and I don't know if a component we created is actually in use.
    Is there a way to find this out?
    Thanks,
    Giulio

    Hi kasq,
    thanks for your quick answer...I tried
    path=/apps/mywebsite/components/scrollable/html.jsp
    and the result was
    XPath query
    /jcr:root/apps/upc-cablecom-ch/components/scrollable/html.jsp//*
    Filtering predicates
    Results
    Number of hits: 1
    Time: 0.16 seconds
    /apps/mywebsite/components/scrollable/html.jsp/jcr:content  (html,  json)
    So how do I have to read it? I see 1 number of hits, that I assume it's how many times it's used from other files...but how do I actually see how many times it's used on all our pages?
    Sorry for this newbie question, but only now I'm getting deeper in CQ5
    Thanks,
    G

  • How to count how many times the caller calls by using UCCX script?

    Hi there,
    My customer wants to do a few changes for their script as below:
    At the beginning of the script they are planning to add a new menu item, it will announce their new privacy policies and to continue the user must press the number one to continue to the Welcome.  If they do not press 1 then the message should repeat itself and if they again do not press 1 they should be transferred over to a live operator who will explain things and then be able to transfer them back to the message so that they can press 1 and continue.
    I modified their script as attached file, but i don't know how to count how many times the caller calls in "Get Reporting Statistic".
    Any helps would be appreciated.
    Thanks.

    Hi Aaron,
    At beginning, i want to use a variable to get number of mistake for the same caller, then we will send the call to right place to fulfill the customers' needs. 
    Do you have any suggestion for the new posted script?
    Thanks.

  • Late sleep on MacBook Air, it must be the very long list of history in repair permission that how many times I repair it, when it's done, I do it again, suddenly it's a long list again, all about iTunes. So what's wrong with this iTunes 11.10.

    I predict something is going wrong because of the list history in verify permission disk. after I repair them for a few second , I do it again and also found that long list again..They are all about iTunes. So what's wrong with it. Thanks.

    As long as the report ends up with 'Permissions repair complete' then, as far as permissions go, you are fine. You can ignore the various statements in the report:
    Permissions you can ignore on 10.5 onwards:
    http://support.apple.com/kb/TS1448
    Using 'should be -rw-r--r-- , they are lrw-r--r--' as an example, you will see the that the permissions are not changed, but the | indicates a different location. This is because an update to Leopard onwards changed the location of a number of system components.
    Poster rccharles has provided this description of what it all means:
    drwxrwxrwx
    d = directory
    r = read
    w = write
    x = executeable program
    drwxrwxrwx
    |  |  |
    |  |   all other users not in first two types
    |  | 
    |  group

    owner
    a little more info
    Before the user had read & write. A member of the group had read.
    After, only the user had read & write.

  • How do I find out how many times a date is in and array collection?

    Hi there,
    I have an arrayCollection that has a bunch of articles in it. I am trying to figure out how many articles there are each day to power a line graph. Any thoughts on how I could easily do this?
    basically I need a method that will return how many times an item appears in and AC.
    Some code I am starting with (its wrong)
    if (fieldName == "yValue"){
         var count:Number = 0;
         for(var i:uint=0; i<_dataProvider.length; i++){
              var date:QueueItemVO;
              if (_dataProvider[i].itemDate == item.itemDate){
                   //count++;
                   trace(count);
         //trace(item.itemDate);
         //trace(count);
         return count;

    Hi there,
    I have an arrayCollection that has a bunch of articles in it. I am trying to figure out how many articles there are each day to power a line graph. Any thoughts on how I could easily do this?
    basically I need a method that will return how many times an item appears in and AC.
    Some code I am starting with (its wrong)
    if (fieldName == "yValue"){
         var count:Number = 0;
         for(var i:uint=0; i<_dataProvider.length; i++){
              var date:QueueItemVO;
              if (_dataProvider[i].itemDate == item.itemDate){
                   //count++;
                   trace(count);
         //trace(item.itemDate);
         //trace(count);
         return count;

  • Hey! On excel I want to count how many time a text come back in the spreadshit (sum) thx, hey! On excel I want to count how many time a text come back in the spreadshit (sum) thx

    Excel:
    line of cellule with 3 different text. I want to count have many time a text come in the line... Thx for helping me, it is for my job!!

    Hopefully I am understanding your question.
    A typical way to count how many times a word appears in a line of text in a cell is to substitute spaces for the word, one less space than the length of the word. Example:
    A1 has the string "brown red brown green"
    A2 =LEN(A1) - LEN(SUBSTITUTE(A1,"brown","    "))  
    "brown" has five letters so there are four spaces in the substitution text)
    If you want to do several cells at once, counting the total number of times the word appears, concatenate the cells with a space between them
    A1 and A2 have text in them
    A3 =LEN(A1&" "&A2) - LEN(SUBSTITUTE(A1&" "&A2,"brown","    "))

  • How many times am I going to have to set my ring tones????????!!!!!!!!!!!!!

    Due to some glitches with contact syncing with groups and what not, I have now had to reset all my custom ringtones for the 8th time!!!
    Unbelievable.

    I can't believe more people haven't complained about this and that there is no answer or the famous "workaround". I have had to reset all my ring tone assignments at least a dozen times over the past year. This is a replacement phone, and has happened many times on either. Was using Outlook 2003 pop mail until recently and now Outlook 2003 in exchange. In both cases, the special individual ring assignments hang around for a while but eventually, sure as shootin, they all return to the default and each must be reprogrammed.
    Well, guess what? I give the f... up. I have finally been beaten. I am NOT going to reprogram all of them again "hoping for the best" from an Apple product only to be played the fool. I'll just pretend it's yet another feature shortcoming. After spending over a year with the phone, I can safely say, nothing on this phone works properly, nothing.
    Message was edited by: Richard Caughlan

  • How many times can you install Lightroom 5? My problem is that I have saved my programs on C. To I have more space, I want to save my programs now on E. Can I now uninstall Lightroom and reinstall from C to E? Can I use the same license code as the first

    Please help!!
    How many times can you install Lightroom 5? My problem is that I have saved my programs on C. To I have more space, I want to save my programs now on E. Can I now uninstall Lightroom and reinstall from C to E? Can I use the same license code as the first installation?

    Thank you for your answers, it helps me a lot.
    But sorry for my ignorance. I understand how you mean it, but I don't know how to do it. I'm scared to lose the settings/edits of the images.

  • All of a sudden, my settings have been changed, my homepage, and EVERYTHING. No matter how many times I go in and change them again, the SAME pages open up when I start FireFox and I am constantly being asked if I want Yahoo as my start page and default s

    I don't know what happened. All of a sudden, my settings have been changed, my homepage, and EVERYTHING. No matter how many times I go in and change them again, the SAME pages open up when I start FireFox and I am constantly being asked if I want Yahoo as my start page and default search engine. I click the box 'do not ask me again' and it comes up EVERY TIME. I change things like I don't want history remembered, and when I reload FireFox again, it's back to the way it was BEFORE. EVERY SINGLE TIME. I don't know why this is happening, or how to fix it. What do I do??

    I do not want to download another virus program.. I do not believe it is a virus. I am running the full version of Norton 360 and it is doing a daily scan. I have Windows 7, 64 bit OS.
    This is very irritating !! If I wanted Yahoo I would ask for it !

  • Hello guys..!! I have got my new  iphone 4 2 days ago.The same day it got a problem of auto restart in every 1, to 2 minutes. I updated and restored it many times...but of no use... can any one help me how to solve this problem..!!

    Hello guys..!! I have got my new  iphone 4 2 days ago.The same day it got a problem of auto restart in every 1, to 2 minutes. I updated and restored it many times...but of no use... can any one help me how to solve this problem..!!

    Go to Settings/General/Reset - Erase all content and settings. the connecto to iTunes and restore as a New phone. Do not restore any backup. If the problem persists you have a hardware problem. Take it to Apple for exchange.
    This assumes that the phone is not hacked or jailbroken. If it is you will have to go elsewhere on the internet for help.

  • HT2513 my iCal calendar that I created with the color green keeps changing to purple.  no matter how many times I change it to green, it turns it back to purple.  Of course this only happens with iCloud and not "from my Mac".  Any ideas?

    my iCal calendar that I created with the color green keeps changing to purple.  no matter how many times I change it to green, it turns it back to purple.  Of course this only happens with iCloud and not "from my Mac".  Any ideas on how to correct this?  This seems like a trivial error, but it's super annoying.

    I called Apple and they said that they know about this problem.  It's a problem with iCloud which their Engineers know about.  (there was a new iCloud release, hence...)  No ETA for a fix yet.  I asked that this be escalated so Engineering doesn't put it at the bottom of their fix list.  I talked to a Senior Advisor and mentioned to them to have QA check their regression tests as this has happened before to me (the problem just didn't take this long to resolve).  I like to use green too for important stuff, so I've resorted to creating a new calendar using the normal calendar green for events going forward.  They could have picked another color besides green to have this problem with and I wouldn't have been so upset.  ;-)

  • How many times can I install Photoshop and Premiere Elements 13?

    How many times can I install Photoshop and Premiere Elements 13?

    mbuenger
    Are you referring to how many times can I install, uninstall, reinstall Photoshop Elements 13 or Premiere Elements 13 on the same computer?
    Or, how many of your computers can have a same purchased activated serial number at the same time for either of these products?
    If the former, I know of no limit.
    If the latter, the answer would be as John as mentioned.
    ATR

  • How many times can you download a song on iTunes and have it count?

    I'm wondering. Someone I like have released a song on iTunes and I wanna support them and I dont mind spending a few bucks on them.
    So how many times can I download a song and still have it count as an individual purchase? And what about gifting?
    thanks.
    -andy.

    As Polydorus said, get only one download per purchase for anything you buy from the iTunes Store other than iOS apps or iBooks. I'm not sure what you mean by "individual purchase" or what you are asking in reference to gifting.
    Regards.

  • How many times can I download from Adobe Creative Cloud, and on how many computers

    I just purchased a one month plan from Adobe Creative Cloud and already downloaded several programs.  Unrelated to Adobe, I reinstalled the operating system on my computer today.  I just downloaded the programs again.  Is there a limit on how many times I can download Adobe software?   I also am planning on purchasing another computer down the road.  How many computers can I download Adobe software from my current Adobe Creative Cloud membership. 
    Thanks-

    You can download and install it as many times as you like but you must activate it in order to use it.
    You can only activate the software on a maximum of two computers at any one time.
    You can deactivate on a computer via Help > Deactivate and re-activate via the same step.

  • How many times can I attempt the passcode before I can't enter it any longer...it has been over 3 hours and it will not let me re-enter it?

    How many times can I attempt the passcode before I can't enter it any longer...it has been over 3 hours and it will not let me re-enter it?  My daughter forgot the new code she put in....

    What dowes the screen say? If it just say disable and gives not time to retry then you have to restore the iPod
    Place the iOS device in Recovery Mode and then connect to your computer and restore via iTunes. The iPod will be erased.
    iOS: Wrong passcode results in red disabled screen                         
    If recovery mode does not work try DFU mode.                        
    How to put iPod touch / iPhone into DFU mode « Karthik's scribblings        
    For how to restore:
    iTunes: Restoring iOS software
    To restore from backup see:
    iOS: How to back up     
    If you restore from iCloud backup the apps will be automatically downloaded. If you restore from iTunes backup the apps and music have to be in the iTunes library since synced media like apps and music are not included in the backup of the iOS device that iTunes makes.
    You can redownload most iTunes purchases by:
      Downloading past purchases from the App Store, iBookstore, and iTunes Store

Maybe you are looking for