How does one generate random integers; first 5 values occur 2 times more than later values

for the following code, how can I get the first 5 values to occur twice as often as the last 5 values?
Do I have to use nested loops?
Begin
  For n in 1 .. 10
  Loop
     dbms_output.put_line (ROUND(dbms_random.value(1, 10)));
End Loop;
End;

Hi,
If you had a lottery with 10 people participating, and you wanted to fix it so that each person had an equal chance of winning, what could you do?  One thing you could do is give tickets numbered 1, 2, 3, ..., 10 to the people, and then pick an integer in the range 1-10 at random.
If you had a lottery with 10 people participating, and you wanted to fix it so that 5 of the people were twice as likely to win as the other 5, what could you do?  One thing you could do is to give 2 tickets to the first 5 people, but only 1 ticket to the other 5.  Since you have 15 tickets now, you'd pick a random integer in the range 1-15.
Here's one way to do that in SQL.  The query below conducts 15 thousand lotteries.  We want the numbers 1-5 to get picked about 2000 times each, and the numbers 6-10 to occur about 1000 times each:
WITH got_n AS
    SELECT  MOD ( TRUNC (dbms_random.value (0, 15))
                , 10
                ) + 1    AS n
    FROM    dual
    CONNECT BY LEVEL <= 15000
SELECT    n
,         COUNT (*)    AS cnt
FROM      got_n
GROUP BY  n
ORDER BY  n
Sample output:
         N        CNT
         1       2048
         2       1939
         3       2020
         4       2066
         5       2007
         6        998
         7        967
         8       1004
         9        980
        10        971

Similar Messages

  • How does one make CC the default out of ACR rather than CC 2014?

    I installed the updates for PS CC and PS CC 2014.  Now, when opening a file out of ACR, it defaults to CC 2014.  How does one set things so that it opens in CC rather than CC 2014?

    GB has two "modes": In "musical time" the units of the timeline are bars and beats, in "real time", they're seconds. You can switch between them by clicking the clock/note symbols near the play button.
    "Snap to grid" only works in the musical time mode.
    An Apple Loop is always supposed to be an integer number of measures long. So if you're in 4/4 it can be 1, 2, 3 ... measures (which is 4, 8, 12 ... beats) long. Since the concept of loops is to be in rhythm with the beat of your song, this makes sense - so it is assured that the "one" of a drum loop, e.g., always sits on the "one" of a measure.
    If your loop is only half a measure long, you can double it to make a full bar. If your loop is not in rhythm at all with a beat - well, then it probably doesn't make sense to turn it into a loop that adjusts to the tempo in the first place. You can still turn it into a "static" kind of loop.

  • How does one delete spam without first clicking on it and therefore causing it to open?

    How do you delete spam without first clicking on it and therefore opening it?

    I'm running 10.6 so I don't know if this works the same in 10.7 -- I would think it will. But if you double click the separator at the center bottom of the Mail window, thereby expanding it (the mouse pointer will turn into a cross), you can then single click and highlight a message without opening it. Next hit CMD-Shift-S, which will save the message to the location of your choice (I use the Desktop), where you can safely read it without ever having opened it. If you like, you can trash the message at this point.
    Double clicking the same point on the window will return the window to normal viewing.
    And, yes, it's a good idea to never actually open spam. Also, make sure load remote images is turned off all the time. An opened remote image is one way spammers know they've found a sucker and they keep it up. If you never open spam, it discourages further spam.
    Opening spam may sometimes actually "do something." A friend of my wife just recently opened a message and it stole her address book. But maybe she clicked on a link inside. Don't know all the details.

  • How does one overcome a lost/forgotten password on time capsule?

    I inherited an Apple Time Capsule that was in use in my office before I received it.  However, I do not know the password to enable its use.  How can I reset the password?

    You can perform a Soft Reset to change the password(s) on the Time Capsule.
    See this Apple support document for more information on all types of resets:
    Resetting an AirPort Base Station or Time Capsule FAQ

  • How does one find Mac Mail mailbox in full Time Machine Backup?

    I completed full backup of my MacBook on 9/24. I use a directly connected G Drive. I need to restore my mailbox from that backup, but it doesn't show up when I attempt to use Time Machine to do so. How can I find the mail box through Finder on the G Drive?
    Thanks,
    Chris Reid

    Further to this issue: I go into the finder and locate my mailbox in Library. When I go to back up 'Library' it goes back to the date in question - but there is no Library found?! There really must be a problem with the backup process. Any thoughts? I really need to find these emails!
    Thanks,
    Chris

  • With my new macbook I attempted to open an older spreadsheet and get the following error message:  "This spreadsheet cannot be opened because ti is too old.  To open it, save it with numbers '09 first"  So how does one do this when I only have ver3.1?

    With my new macbook I attempted to open an older spreadsheet and get the following error message:  "This spreadsheet cannot be opened because ti is too old.  To open it, save it with numbers '09 first"  So how does one do this when I only have ver3.1?

    Numbers 3.x can only open Numbers '09 and later.  You will need Numbers '09 to open Numbers '08 files.
    If it is a single file (or only a few) you can email me and I will open and convert then email back.  My email address is in the "Biography" of my profile.
    You may have Numbers '09 installed.  Look in the folder "/Applications/iWork '09"  if Numbers is in that folder launch it, open the file you tried to open, and save.  Then you should be able to open in Numbers 3.x

  • How does one update Subtemple value from Yes to No?

    Greetings! In the instructions of a published problem statement (Note ID: 808571.11) there is a line that says:
    "c) Check if the subtemplate is set to NO. Update it to NO if it is set to Yes."
    How does one update the Subtemplate value from Yes to No? In edit configuration, I do not see a Subtemplate value column.
    Many thanks in advance fr your suggestions.
    Tom

    With all due respect ... I do not see how one can change the Subtemplate value from Yes to No. When I query the offending Template, the Subtemplate column is not displayed in bold, indicating to me that it can not be updated. Clicking on Edit Configuration, doe not provide an ability to change the value either.
    As best I can determine, one needs to 1) query up the template
    2) download the rtf file(s)
    3) end date the template
    4) create a new template and then set the Subtemplate value to No.
    And the same steps appear to be required in order to add or update a template Description.
    Which raises the question, Why can this not be done by editing the configuration?

  • Sorry if tis is naive.  I have just bought my first iPad Retina Display.  I have WiFi at home but it has taken ages for me to connect as I needed all sorts of codes, passwords, detauils etc.   How does one connect to the web (Google) when one is out and a

    Sorry if this is a bit naive.  I have just bought my first iPad (Retina Display).  I have WiFi at home but it has taken me ages to get on-line as I needed all sorts of codes, passwords, numbers etc.
    How does one connect to the web (Google) when one is out and about?
    Thanks

    haha, You're welcome
    Maybe these links will be useful
    ipad manual/user guide
    http://manuals.info.apple.com/en_US/ipad_user_guide.pdf
    ipad support page
    http://www.apple.com/support/ipad/
    ipad assistant
    http://www.apple.com/support/ipad/assistant/

  • Just given my first iMac. How does one use cd's when there is no slot?

    Just given my first iMac. How does one use CD's when there is no slot?

    Oaxaca36 wrote:
    How does one use CD's when there is no slot?
    http://store.apple.com/us/product/MD564ZM/A/apple-usb-superdrive

  • How does one pay their bill

    I have been a Verizon wireless customer for10+ years and switched to FIOS internet and TV a few years ago.  When I first switched I set up the one bill account, where it then took me over 8 hours on the phone to finally get FIOS and wireless Verizon to acknowledge each other exists.  All went well until thismonth's billing cycle.  When I went to log into my account, the system decided to make things more convenient for me by no longer taking my old user ID and password, but giving me the opportunity to get a new user name and password.  All I needed to do was enter my home phone land line number, which I don't have a land line, or my account number with the new user ID which I can't get because I can't log in to take advantage of this wonderful opportunity.  After spending over an hour on the phone listening to the electronically generated drone of the voice telling me all agents were busy, mind you this was starting at 8:45, 15 min prior to the go time, and listening to the wail of the Kenny G music, the agent told me that it wasn't their department.  After another 40+ minutes of aural torture, I gave up, went out and shot several furry creatures and contemplated the meaning of life.  How does one pay their bill under these circumstances?  I even tried to use the 969 phony home phone  number they gave me.  What are my options and yes, in one month I will be canceling anything to do with Verizon TV and internet.

    Sorry you are having difficulty, an agent with access to your account will reach out to you directly by email, private message in the Forums and/or the billing telephone number on your Verizon account for more information to help you resolve your issue.

  • HT1918 How does one organise the apple ID so that one uses the same email address to have an account on both the UL and Belgian itunes stores?

    I have in the past created an Apple ID for use with the UK itunes store, because I want to read in English.  If I sign in it seems that this ID will only allow me to purchase from the UK store.  But I live in Belgium, so I can't download from the UK store.  So I tried to create an apple ID for the Belgian itunes store.  But I want to use the same email address as I used for the first apple ID I made (because I'm fed up of having to remember which email address I used for which account).  When I tried this, I just get a message saying that the email address is already in use for another account (which I know, because it's me who made that account).  Does anyone have a workaround for this?
    cheers
    Andrew

    I have tried again using the same password. and it still doesn't work.
    I'm presuming you went ahead and set up a new Apple ID, yes? Using the same password in more than one Apple ID has worked for me in the past, but I haven't tried it in a while so the tightened security may have changed that. You could use the same password but add "-UK" and "-BE", or something like that, to make it easier to remember.
    I understand what you mean about losing the ability to deal with UK purchased stuff, but this is becoming so inconvenient that I do want to delete that UK apple ID account.  I have looked everywhere I can think of on the apple website (apple id, itunes, support etc) and I can't find a link/eplanation/contact point that deals with deleting apple ID and itune store accounts.  Surely this must be possible?
    It's possible, but Apple is very reluctant to do it, and it's not something a user can do on their own. It would be better to just stop using the UK account rather than trying to get it deleted. Just remove your payment information and there should be little reason to have the account deleted. If you really want to try, though, you'll need to send a message to iTunes support specifying that you want the account cancelled.
    On a completely different matter, I have bought my son an ipod touch.  But since he is younger than 13 years old, how does one go about using the itunes store to get music onto his ipod touch?
    You would need to buy tracks for him; he's too young to have his own iTunes Store account. To control what gets synched to his iPod, this should help:
    http://support.apple.com/kb/HT1495
    Regards.

  • How does one pass import parameters to a report within a method?

    Hello all,
    Well how does one  pass import parameters to a report which is within a method ...end method.
    for example :
    method 123
    SUBMIT reportname using selection '1000'
    endmethod .
    Here we need to pass values into the selection screen and run the report for those values.
    The values are say 'ABC'   (  tablename "DEF" and field name "HIJ" ).
    I hope the question is clear, awaiting your response 
    Thanks and Regards,
    Sandeep.

    Go to SE24
    Parameters: Give the Parameter name, Typing method is "Type" is the domain type that u are selecting, say for e.g :  Parameter is "P_CONT" , its associated type "CHAR32" etc
    For Select Options:  Parameter name say "S_CUST", Type"importing". For this you need to give an associated type which must be created as "TABLE TYPE " in SE11. That table type needs to have a "LINE TYPE" .
    LINE TYPE is a Structure created with components "SIGN, OPTION, LOW & HIGH" for select-Options.
    NOTE: for a Table type related to Customer data fields "say KUNNR", the line type created must have the Component Type and data Type corresponding to the Data Element associated with "KUNNR" ;i.e: "CHAR" etc.
    See if this is clear to you or revert back in case of any Confusion.

  • How does one change ownership of event?

    How does one change ownership of an event?
    We are running OCS 9.0.4.2 on redhat enterprise linux 3.0
    I have a calendar entry which I got from:
    mySess.fetchEventsByRange(Api.CSDK_FLAG_STREAM_NOT_MIME | Api.CSDK_FLAG_FETCH_EXCLUDE_DAILYNOTES |
    Api.CSDK_FLAG_FETCH_EXCLUDE_DAYEVENTS, hand, in_start, in_end, eventProp, result);
    BEGIN:VEVENT
    UID:20050620T151524Z-505dd-1-7af6ed32-Oracle
    ORGANIZER;X-ORACLE-GUID=FEA199DDB9763627E030378E793341C1;CN=old owner:mailto:old.owner@email
    DTSTART:20050801T120000Z
    DTEND:20050801T220000Z
    END:VEVENT
    So now I'm trying to save the event under the new owner using this:
    mySess.storeEvents(Api.CSDK_FLAG_STORE_MODIFY,event,result);
    where event reads as follows:
    BEGIN:VCALENDAR
    VERSION:2.0
    PRODID:-//ORACLE//NONSGML CSDK 9.0.4.2//EN
    BEGIN:VEVENT
    UID:20050620T151524Z-505dd-1-7af6ed32-Oracle
    ORGANIZER;CN=new owner:mailto:new.owner@email
    DTSTART:20050805T120000Z
    DTEND:20050805T220000Z
    END:VEVENT
    END:VCALENDAR
    And i've run mySess.setIdentity to change to the old owner and new owner with no success?
    Please how does one change the owner of an event?

    The Calendar Sdk doesn't allow you to change the ownership of an event. (ORGANIZER value).
    Regards,
    Jean-Philippe

  • How Does One Modify Photoshop Templates in Dreamweaver

    I posted this over on the Photoshop forum, but no one has
    replied. It is a hybrid sort of question.
    I've been trying to modify the Horizontal Neutral template of
    the Web Photo Gallery in Photoshop CS using Dreamweaver MX (v.6.1)
    on my G5 running Tiger and am almost there. Aside from the overall
    design (fonts and colors) I really like the interface of this
    particular gallery with a horizontal slider to quickly scroll
    through images, that when selected, appear in large form in the
    center of the page. But I need to customize it to get it to match
    the feel of my site.
    My problem: I'm trying to point to a gif file that is part of
    my website image library as my background. I want the Horizontal
    Neutral Gallery to float in that image background. But, I can't
    seem to get the background image to appear where it is supposed to.
    I've gone into the various components of the template
    (FrameSet, SubPage, etc.) and by duplicating the files and
    modifying the code, I am able to get the background image to appear
    within the tables that make up the navigation and image gallery
    components. But, I've not been able to get the image to appear as
    the background itself.
    I'd even be happy to simply have the entire Horizontal
    Neutral Gallery float in the middle of one of my own pages with the
    image file as a background if it is possible, but can't seem to
    even get it to do that. How does one access the code that controls
    the background image in this template or the script that generates
    these galleries?
    Thanks in advance!

    The reason the that the edit button ( - ) top righthand corner had 'disappeared', was that iCloud was enabled but that the Addressbook subsetting under iCloud was set to off in the phone settings.
    Changing it to 'on' made the edit button reappear.
    Thanks to the guys in Cambridge Apple Store!!
    The reason the that the edit button ( - ) top righthand corner had 'disappeared', was that iCloud was enabled but that the Addressbook subsetting under iCloud was set to off in the phone settings.Changing it to 'on' made the edit button reappear.
    Thanks to the guys in Cambridge Apple Store!!

  • How does one create LOV Map between 2 fields for custom lookup mapping

    Hi there
    In Internet Expenses, Expense Report Line Detail we have two unrelated fields; namely Expense Location & Tax Code.
    The requirement is to map a default tax code to locations; basically when a user enters Expense Location then the mapped tax code value should default into field Tax Code.
    The location-tax code mapping is stored in a custom lookup (FND_LOOKUP_VALUES).
    My question is how does one go about implementing this?  For example is it possbile to create a new (hidden) LOV based on the lookup mapping & then create a Personalization LOV Mapping between the 3 LOV...  Or is it necessary to modify the Tax Code drop down Message Choice in JDeveloper?  Of course details are appreciated!
    FYI below is the relevant Personalization Structure from "Personalize Stack Layout: (NormalDetails)".
    Message Lov Input: Expense Location
    - Lov Mappings
    -- Lov Map: (lovMap1)
    -- Lov Map: (lovMap2)
    -- Lov Map: (lovMap3)
    - Message Text Input: Expense Location
    - Message Styled Text: Transaction Location
    - Message Text Input: Merchant Name Yes
    - Message Styled Text: Description
    - Message Check Box: Original Receipt Missing Yes
    - Message Choice: Tax Code
    - Message Check Box: Amount Includes Tax
    - Message Choice: Tax Code
    Many thanks
    G

    Hello all
    The correct & supported method is this:
    Extend the location LOV in JDeveloper & add a "default tax" attribute, this could be derived from a new location DFF storing the default tax code for each location. Now simply create a location Personalization LOV Map which takes this new location lov tax attribute & target it to the tax message choice field.
    That's my 2c worth anyway, so please give comment if you feel there is a better way.
    There is just one more little problem however... The requirement has changed! Now we require the tax code to default according to not one location field, but other fields too. For example if the user selects Expense Type of Beverage & Location of Netherlands then Tax Code should be NL19%, for Expense Type of Hotel then it should be NL6%; if the user ticks "Missing Receipt" field then it should over ride all others & set the code to NL0%.
    Any ideas?
    Many thanks
    G
    Edited by: user13363208 on 11-Aug-2010 06:51

Maybe you are looking for

  • 10g Nested Tables and APEX

    Trying to use the following within Apex: CREATE TYPE location_typ AS OBJECT ( location_id NUMBER(4), street_address VARCHAR2(40), postal_code VARCHAR2(12), city VARCHAR2(30), state_province VARCHAR2(25)); CREATE TYPE nt_location_typ AS TABLE OF locat

  • "Break out" black and pms for prepress?

    Help please? I am working in Illustrator CS4, and finished a 2-sided mailer/postcard for a client in cmyk. After emailing the final PDF to the client, the client responded back to me with their print provider's request for- "native file, with black a

  • Multicam fiasco isn't over... it just got moved!

    I was overjoyed to find out that Premiere Pro CC will bring us something Adobe users have never had until now... a multicam tool that actually works! (i.e. the painfully stupid 'auto switch back to original camera angle when playback stops' problem h

  • Acrobat Reader Prints Strange Characters

    The Reader prints files in a strange character encoding which looks like nothing - )*&#$@^(%)&%@#?><{::} and characters you cannot find on your keyboard. When printing from other PC's it's working perfectly. It does that with all languages and all PD

  • HTML Snippet won't work.

    I am creating a new site on iWeb 08. I want to have a snippet of my "Blog" page in a box on my "Home" page. I published the site, went online and copied the view source (HTML Code). I then went back to iWeb and pasted the HTML Code into the snippet b