Random generation of numbers

Hi,
I need to generate numbers randomly between the range of 1-50. I was trying to use the DBMS_RANDOM package. But, this seems to work best for numbers at least 6 digits long. I don't want any duplicate numbers also. Any ideas?
Thanks so much.

Hi,
I need to generate numbers randomly between the range of 1-50. I was trying to use the DBMS_RANDOM package. But, this seems to work best for numbers at least 6 digits long. I don't want any duplicate numbers also. Any ideas?
Thanks so much. maybe this way
write a PL/SQL funtion returning resul-set with many - say twice as much as you need - random number
via ref-curcsor
( make count returned rows a parameter and mod()-value for the function )
select distinct * from the_ref_cursor

Similar Messages

  • String random generation for length 3

    Dear Sir,
    How can i generate random generation of alphabets of length 3 in labview?
    ex:adg,beg etc
    Thanks in Advance
    Regards,
    Sai Chitra.

    Hi chitrar,
    Here is a way for caps only:
    1) Use decimal to ASCII numbers for your letters 
    2) Generate a random number from 0-25
    3) Add the result to the first letter (A) position which is 65
    4) Repeat 3 times
    5) Convert to U8 and then use Byte Array to String to get your string
    Note if you want lower case also, change the 25 to 51 and then add 7 if the random number result is greater than 25.
    steve
    Help the forum when you get help. Click the "Solution?" icon on the reply that answers your
    question. Give "Kudos" to replies that help.
    Attachments:
    random alphas.vi ‏9 KB

  • Pre Plus randomly erasing phone numbers

    My Palm Pre Plus is randomly erasing phone numbers since I received it last Thursday.  I suspect it has something to do with Synergy's syncing to my various accounts.
    Example situation:  Yesterday morning a friend texted me to see if I wanted to meet at a coffee shop.  I told him yes, and we went and had coffee.
    This morning, I went to text the same friend, only to find that his phone number was no longer listed under his contact profile.  My only messaging option was through Google Talk (which I don't think counts) - even though my txt's from yesterday were still listed, had the little SMS marker - AND his phone number - next to them, in small grey font.  But with no phone number, there was no SMS option.
    I tried chatting with a Palm support person before leaving for coffee yesterday, who at first didn't believe that I had upgraded my phone to 1.4.  They hadn't gotten the memo of its release yet.  The situation was dropped with the hope that 1.4 had fixed the problem.  It hasn't. 
    What's the deal here?
    Also - I continue to have that infamous double type or missing letter problem with the keyboard.
    In addition - does anyone else find it incredibly silly that virtually my entire contact list is impermanent?  In other words, half of the information relies solely on my contacts maintaining their Facebook profiles and including their phone number and such.  If a person's phone number has been pulled into my contacts from Facebook, and they decide to erase their Facebook account - boom - I no longer have their phone number.  I suppose I could enter a duplicate phone number entry - but who has time?  And with the above issue, how do I know it will even stay there?

    I have my Google account as my default profile, however most of my contacts were pulled in from Facebook and I manually entered phone numbers when necessary from my old Centro.  I re-entered my friend's phone number and it has stuck around since last weekend, so hopefully as the other user above mentioned, it's just one of those things that happens early on and then sorts itself out.
    I did a bit of testing today, to see how my phone was syncing to my google account, which was syncing back to Address Book on my Mac.  If I delete a contact on my phone, or any part of a contact's information, it is erased from my google contacts on the next sync, and thus my Mac's address book on the computer's next sync.  So now, all this information seems tied to me keeping my phone up to date.  I wish it was just additive, not destructive.
    I'm still somewhat upset over the apparent fact that my accounts are impermanent.  I don't like the idea that I have no permanent record of a contact.  If a friend is being pulled into my contacts from Facebook, and she has no other account associated with me, it seems that their existence in my address book is dependent on them maintaining their Facebook profile.  I have no way to "lock it in" as it were.  It doesn't seem that facebook-only contacts added into my Google contacts either.  It's all a bit confusing.
    I will have Verizon look into the keyboard issue.

  • Random missing letters/numbers on screen

    Yesterday I noticed that while charging my ibook, the %charge read "8 %", meaning it was 80-something percent charged and the second digit was invisible.
    A few moments later, the number 8 disappeared, then re-appeared, and random letters and numbers would shift, every few minutes, between disappearing, then re-appearing.
    When my SO was typing an email, using Yahoo mail on Safari, later last night; random letters would also be invisible in her email. Apple Mail seemed unaffected, and her email to me read with no invisible letters.
    Any idea of what's going on?
    This may not be related, but my hard drive has been a little loud lately. I'll back everything up tonight, just to be safe.
    Thanks,
    John

    Yes, do back up right away.
    Also, try a Safe Boot... holding Shift key during boot up.
    These two also...
    Using Disk Utility in Mac OS X 10.4.3 or later to verify or repair disks...
    http://docs.info.apple.com/article.html?artnum=302672
    About Disk Utility's Repair Disk Permissions feature...
    http://docs.info.apple.com/article.html?artnum=25751
    Get a cache cleaning program, or just get Applejack...
    http://www.versiontracker.com/dyn/moreinfo/macosx/19596
    After installing, reboot holding down CMD+s, then when the prompt shows, type in...
    applejack AUTO
    Then let it do all 5 of it's things.
    At least it'll eliminate some questions if it doesn't fix it.
    The 5 things it does are...
    Correct any Disk problems.
    Repair Permissions.
    Clear out Cache Files.
    Repair/check several plist files.
    Dump the VM files for a fresh start.

  • I downloaded Vtok to my new iTouch but half my contacts are random letters and numbers and there are no profile pictures.  I tried reinstalling the app but the same thing happened.  Any suggestions?

    I downloaded Vtok to my new iPod touch but half the contacts came up as random letters and numbers and there are no profile pictures.  I tried reinstalling the app but the same thing happened.  Any suggestions?

    Go to the developer's support site.
    iOS: Troubleshooting applications purchased from the App Store

  • Five Random Number Generation between numbers 10-20

    I want to generate 5 random numbers (U32) between a range of 120 and 180 with equal distribution. Can i do it? I tried using white noise generation VI, but it gives numbers from [-a,a].
    Thanks in advance.

    stevem181 wrote:
    Note that the 120 and 180 values occur about half as often as the other values.
    To correct that flaw, multiply by 61 and round to -infinity. For example like this:
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    RandomRange.png ‏17 KB

  • Random number generation in numbers

    I cannot find out how to create a random number colum. It ios very easy on Excell ,but my attempts on numbers have been frustrating. I look at the instructions, but when I click on formulas it doesnt show the whole list.

    Clark,
    You might find it convenient to have Formulas and Functions Help open as you work on your document. It has a little different layout than the Function Browser.
    Jerry

  • GENERATION OF NUMBERS

    Pls, I have written a program. However, I'm expected to include sub-program that will generate numbers automically for students. For example, the number for first student may be 12367GE and the next may 56789AW.
    Pls, how do I do that?
    Thanks

    Thare is no problem in generating random number you can use Random class for that.
    But the problem is making sure that your applet generate unique numbers.
    No Random Number generation algorithm garantees the generation of unique number they just geive "Random Numbers" and there can be duplicates.
    So your program will need a way to store the previously generatly numbers so when you generate the next one you have to compare the generated number with the old ones to make sure it is unique if not uniques you have to repeat the proces until you get a unique number.
    Using a file is not good idear since once the file grow in to a large one the algorithm will run very slow.
    Keeping them in memory is not that good becouse you will loose them when the server is restarted and also can caoue out of memory errors.
    A simple database will be the best option to keep the old data
    Ex:-
       while(true){
         int newNumber = generateRandomNumber();
         if (oldNumbers.isUnique(newNumber)){
            oldNumbers.store(newNumber);
            return newNumber;
       }Or you will have to write a random munber algorithm which always garantees to generate unique numbers without actually storing and compairing with the old numbers

  • Displaying 3 random and unique numbers out of 6

    The following program gives me the results in the output panel because I used trace.  The problem is that I want these numbers displayed when I click on a button.  The numbers should not duplicate when the button is clicked, for example not "3, 3, 2" but "3, 2, 5".  Here is the program that randomly selects numbers (which by the way is not mine):   (I'll happily donate 15$ to the animal charity of your choice for whoever can give me a hand with this problem, thanks!)
    var mynumbers:Array = ["1","2","3","4","5","6"];
    var mystuff:Array = [];
    var randomCount:Number = 3;
    var r:Number;
    for (var i = 0; i<randomCount; i++)
    r = Math.floor(Math.random() * mynumbers.length);
    mystuff[mystuff.length] = mynumbers.splice(r,1);
    trace(mystuff);
    //and here is my button code
    generate_btn.addEventListener(MouseEvent.CLICK, coco);
    //3.;
    function coco(event:MouseEvent):void

    Hi
    I am trying to replace the numbers in the random script with pictures. I thought that all I had to do was replace the numbers in the array with pictures name.
    I am getting the output as picture names instead of actual images. I just started flash a few weeks ago and would appreciate where I am going wrong in the code below. I know, it's a bit ambitious for someone who has no experience in programming or mathematical background. I think, that is the only way to learn. By asking the experts in programming. Otherwise, I just give up, and go back to watching TV.
    var mynumbers:Array = ["alfa.jpg","beta.jpg","alfa1.jpg","alfa2.jpg","alfa3.jpg","alfa4.jpg"];
    var randomCount:Number = 3;
    function shuffle(a:Array) {
        var p:int;
        var t:*;
        var ivar:int;
        for (ivar = a.length-1; ivar>=0; ivar--) {
            p=Math.floor((ivar+1)*Math.random());
            t = a[ivar];
            a[ivar] = a[p];
            a[p] = t;
    //and here is my button code
    generate_btn.addEventListener(MouseEvent.CLICK, coco);
    //3.;
    function coco(event:MouseEvent):void
    shuffle(mynumbers);
    for(var i:int=0;i<randomCount;i++){
    if(!this["tf_"+i]){
    this["tf_"+i]=new TextField();
    this["tf_"+i].text = mynumbers[i];
    addChild(this["tf_"+i]);
    this["tf_"+i].y = i*40;

  • I need a Random  generation  of password with the following conditions

    ***Random Password Generation Program***
    Also the password should be stored in the LDAP with SHA format.
    The status should be changed to unlock, the password expired column should be updated,
    so that the user should change the password when he login to the ecommerce portal
    &bull; Minimum length 8 character
    &bull; Password must be constructed using characters from at least three of the following categories:
    o Upper case
    o Lower Case
    o Numerals
    o Special Characters
    &bull; Customer passwords will never expire
    &bull; Lock account after 6 consecutive failed attempts

    I have the same problem. It ask for all elements that proxt detects ("NetworkError: 407 Proxy Authentication Required").
    Solution "No proxy" not works because i aslo require internet.
    I have version 10.0.2 on windwos XP, and this happens to me since I update it. On chrome and ie works without prompt.
    I upload and example, this page calls facebooks elements (i can't acces facebook) and others, for each element prompt proxy is shown.

  • Choosing serveral random and unique numbers

    Hi
    I'd like to select 9 random numbers out of a set of let's say
    1-20. They can't repeat and each has to be saved into a different
    variable P1-P9.
    Any ideas?
    Thanks

    Make an array of the numbers 1 through 20.
    Shuffle the array.
    Take off as many numbers as you need.
    Search the forums for shuffle to find out how to shuffle the
    array.

  • HT204150 I have started randomly losing contact numbers, but not email addys for same contact

    I have started losing contact ph nbrs, not the email address if there is one. But random numbers just disappear.  Any advice?

    Hello hwestphal, 
    Thanks for contributing to the Apple Support Communities. 
    It looks like you were not able to send iMessages to your contacts, and you've solved it by turning iMessage and FaceTime off and on again. It sounds like after this, your friend is not receiving iMessages because they are sending from your phone number. 
    Next, I'd suggest the steps in this article to make sure that your phone number is linked to your Apple ID (email address):
    iOS and OS X: Link your phone number and Apple ID for use with FaceTime and iMessage - Apple Support
    Your friend may also want to try these steps on their iPhone when they are in range of cellular service. 
    Best Regards,
    Jeremy 

  • How to random 7 individual numbers?

    Hello.
    I am pretty new in Java, but i have basic understanding of it. :)
    My question is:
    How can you get 7 individual randomed numbers between 1 and 39?
    I am making Lotto-game, so numbers should be individual. Like 1,7,9,15,20,35,39. Not 1,7,11,11,23,34,36.
    I have tried (Math.random() * 38 + 1); but obivously it dosnt fit in here.
    I tried to use search, but didnt find exactly this kind of a problem. Thank you.

    I used DzzD's method.
    I used it like this;
    Object MyNewObject;
    Vector v=new Vector();
    for(int x=1;x<=39;x++)
    v.addElement(new Integer(x));
    for(int x=1;x<7;x++)
    MyNewObject=(v.remove((int)(Math.random() * (38 - x))));But then again.. how i can get the numbers from MyNewObject? My lotto-machine should compare them to player feeded numbers.
    Like:
    Player has feeded following numbers: 2,5,6,21,24,35,37
    Lotto-machine have randomed following numbers: 1,5,8,12,20,25,39
    My program should count how many right numbers are in row. In this case there would be 1 right number, and it is number 5.

  • IPhone is randomly calling different numbers

    Hi,
    I am extremely unhappy with iOS7 - the worst Mobile Operating System ever!
    I was iPhone costumer since day 1, i had 2 iPhones before and the old iOS version were pretty good and made the device handy.
    But now, after "upgrading" to iOS7 its nearly useless - It has often freezes, does not respond on touchscreen-events, its extremely slow etc.
    BUT the following bug is an absolute no-go:
    When I try to call someone using the recent call list, sometimes the iPhone just calls someone from the list by random!
    E.g. I try to call "Parents", the display shows: "Calling Parents..." but on the phone is my Boss and so on.
    This is a serious issue!
    I was loosing a Hotel reservation because of that, the wrong reception was in the line and could not recognize this?!
    The next thing is this ugly cheap Apple-Maps-App. When I search for a resturant or hotel, the popup comes up and instantly calls the number and I have no chance to end this call, because the Touchscreen does no respond. So annoying!
    My iPhone 4 has no jailbreak, I also set it back to factory defaults and reinstalled everything, but no effect. I even tried to downgrade to iOS6 but seems there is no chance.
    I can´t imagine that I am the only one with such iPhone problems. Maybe someone knows a workaround or knows how to contact Apple (they want 35 EUR from me for contacting the support, ***?!)

    Try resetting it: Hold the home butting + lock button for 10-12 seconds until the Apple logo appears.

  • Random Generation without repeat

    Hi, I am trying to write a script that will generate a random 5 digit number, using only the digits 1, 2, 3, 4, & 5, and with no repeats. For example: 12345, or 31524, or 24153. At the moment I can make the random 5 digit number, using only the digits 1, 2, 3, 4, & 5, yet I am struggling to get no repeats. So far I have something along the lines of:
    set x to some item of "12345"
    set y to some item of "12345"
    set z to some item of "12345"
    set a to some item of "12345"
    set b to some item of "12345"
    if x = y then
    if x ≤ 1 then
    set x to x + 1
    end if
    if x ≥ 5 then
    set x to x - 1
    end if
    else if x = z then
    if x ≤ 1 then
    set x to x + 1
    end if
    if x ≥ 5 then
    set x to x - 1
    end if
    else if x = a then
    if x ≤ 1 then
    set x to x + 1
    end if
    if x ≥ 5 then
    set x to x - 1
    end if
    else if x = b then
    if x ≤ 1 then
    set x to x + 1
    end if
    if x ≥ 5 then
    set x to x - 1
    end if
    else
    set itemsOne to x & y & z & a & b
    end if
    set itemsOne to x & y & z & a & b
    itemsOne
    Any Ideas??
    Thanks for any help you can give,
    MrBlobE

    Hello
    In addition to what others have said.
    This sort of script could be done efficiently by class filtering of index list.
    The basic is this :
    {1, 2, false, 4, false}'s integers --> {1, 2, 4}
    {1, 2, false, 4, false}'s some integer --> {1, 2, 4}'s some item --> 2, e.g.
    Thus you might try something like this :
    --set nn to {1, 2, 3, 4, 5}
    set nn to "12345"
    return some_permutation(nn)
    on some_permutation(aa)
    script o
    property xx : aa -- source list
    property yy : {} -- result list
    property kk : {} -- index list
    repeat with k from 1 to count my xx
    set end of kk to k
    end repeat
    repeat (count my kk) times
    set k to my kk's some integer -- some integer (class filter)
    set my kk's item k to false -- suppress the chosen index
    set end of my yy to my xx's item k -- extract item by chosen index
    end repeat
    if my xx's class = list then
    return my yy's contents
    else
    return "" & my yy
    end if
    end script
    tell o to run
    end some_permutation
    Regards,
    H

Maybe you are looking for

  • 'Authorization for replace' sy002

    SAP System gives me this error in debbuging mode. I suppose it is something related to authorization when modifying the content of variables (which is what I was doing). What would be the problem ? Thanks in advance.

  • I want to exchange my Japan iTunes card to U.S.!

    I want to exchange my Japan iTunes card to U.S.! Is there a way to do this???

  • Wireless Differences between the US and Australia

    Can anyone tell me if there are any differences in ordering products (access points) for Australia?  Should I use difference part numbers other than what I would use for the US?  Also are there any differences in 2.4 or 5ghz channels? Thanks for the

  • VS2010 with Oracle 11g Release 2 giving Package did not load correctly

    Hey , I had a Oracle 11g Release 1 11.1.0 installed on my machine. I had a client and over that a installation for Visual Studio tools for VS2008 installed. So in the directory of 11.1.0 I had two folders of Client 1 and Client2 . I was able to use t

  • GR Posting Time

    Hi SAP Experts, Greeting to all of you!!! In one of the report I wanted to perform some calculation related to GR Date and time. So I was looking for field that would contain the DATE and TIME at which the GR was done. I tried looking at the MSEG tab