Problems creating an array and mixing them up

I am trying to create an array (1-35), mix that array and display the results with a trace. I am getting an error withthe following code.
public function generateArray(toNumber : int) : Array {
        var result : Array = [];
        for (var i : int = toNumber; i != 0; i--) {
        result.push(i);
        return result;
        public function shuffle (a:Array,i:int):Array
        {var rndm:int;
        var b:Array = a.slice();
        var c:Array = [];
        while (i) {
        rndm = Math.random() * b.length;
        c.push(b.splice(rndm,1)[0]);
        i--;
        return c;
         /*limit question display to 35*/
         generateArray(35);
         trace(generateArrays);
the error(s) are:
1180: Call to a possibly undefined method generateArray.
1120: Access of undefined property generateArrays.
please assist with resolving these problems.
thanks in advance!

generateArray(35) and that trace() must be inside a method (or methods).  for example,
    internal class Mixer {
        //retains the array that is consulted for random question numbers
        private var randomizedOrder:Array;
        //CONSTRUCTOR - passed total number of questions in section
        public function Mixer (questnsTotal:Number) {
            randomizedOrder = new Array();
            randomizedOrder[0] = Math.floor(Math.random()*questnsTotal);
            for (var i:Number=1; i<questnsTotal; i++) {
                randomizedOrder[i] = newNumber(questnsTotal, i);
            for (var k:Number=0; k<questnsTotal; k++) {
                trace(""+k+": "+randomizedOrder[k]);
  /*limit question display to 35*/
         generateArray(35);
         trace(generateArray);
        //recursive function that creates a new number until it creates one that isn't already in use
        private function newNumber (qTotal:Number, curNum:Number):Number {
            var newNum:Number = Math.floor(Math.random()*qTotal);
            for (var j:Number=0; j<curNum; j++) {
                if (randomizedOrder[j] == newNum) {
                    return newNumber(qTotal, curNum);
            return newNum;
        public function generateArray(toNumber : int) : Array {
        var result : Array = [];
        for (var i : int = toNumber; i != 0; i--) {
        result.push(i);
        return result;
        public function shuffle (a:Array,i:int):Array
        {var rndm:int;
        var b:Array = a.slice();
        var c:Array = [];
        while (i) {
        rndm = Math.random() * b.length;
        c.push(b.splice(rndm,1)[0]);
        i--;
        return c;
        //This is how external classes acquire a random number from this class's array
        //(programNum = the question the program wants to ask next, based on sequential order, or user selection)
        internal function getRandomNumber(programNum:Number):Number {
            return randomizedOrder[programNum];

Similar Messages

  • I am having problems creating PDF file and downloading them

    I am having problems creating PDF file and downloading them

    Hi Randy Keil,
    You might need to sign up with your Adobe ID and password at "https://cloud.acrobat.com/convertpdf"
    Then you can choose the desired files to create the PDF.
    Now, let me know what error message do you get while doing the same.
    What kind of files are you trying to convert to PDF?
    Have you checked with your internet connection and tried using a different browser?
    Hope to get your response.
    Regards,
    Anubha

  • Main.vi creates 2D Arrays and I want to save the arrays in an microsoft Excel file(e.g engine_1)and in differnt worksheets(e.g. measure_1;measure_2;...)

    main.vi creates 2D Arrays and I want to save the arrays in an microsoft Excel file(e.g engine_1)and in differnt worksheets(e.g. measure_1;measure_2;...)
    The path(Grundpfad)for the excel file should be inserted in the main.vi.

    1. There's a shipping example called Write Table To XL.vi (Help>Find Examples>Communicating with External Applications>ActiveX>Excel) that you can use as a starting point.
    2. Buy the LabVIEW Report Generation Toolkit. Info can be found here.
    3. Search this forum for other examples of writing to Excel.

  • I would like to create a playlist of some of my voicememos to hear on my iphone5. I have no problem creating the list and can listen on playlist on computer but not when i sync to my phone. How can I listen to voicememos in a playlist on my iPhone?

    I would like to create a playlist of some of my voicememos to hear on my iphone5. I have no problem creating the list and can listen on playlist on computer but not when i sync to my phone. How can I listen to voicememos in a playlist on my iPhone?

    Hi czigrand,
    Thanks for visiting Apple Support Communities.
    Currently, you can gift dollar amounts or individual items (EG. songs) on the iTunes Store. See this article for more information:
    In the iTunes Store, you can gift a dollar amount or specific music, movies, TV shows, or apps from your iPhone, iPod touch, iPad, Mac, or PC. Follow these steps to send a gift from the iTunes Store.
    iTunes: Sending iTunes Gifts
    http://support.apple.com/kb/HT2736
    Best Regards,
    Jeremy

  • How to create mass users and map them to existing  hrms users

    Hi,
    Im running oracle ebusiness suite 12i . I want to create mass users , and map them to existing hrms users.
    The users I want to create exist in an excel spreadsheet with the columns employee id, user name. They will all be granted the same responsibility. I want to map them to existing hrms users using the employee id key.
    I have read about the package FND_USER_PKG.CREATEUSER and I can loop over it by using sql loader to create a temporary table, but I m lost on how to automatically map them to hrms users as part of the script.
    Any help.
    dula

    Thanks a lot Omka,
    I managed to create the users by running the script:
    declare
    Cursor C1 is
    select d.product_code,b.responsibility_key from FND_USER_RESP_GROUPS_ALL a,fnd_responsibility b,fnd_user c,fnd_application d
    where a.user_id = c.user_id
    and a.responsibility_id = b.responsibility_id
    and b.application_id = d.application_id
    and c.user_name ='JOCHIENG';
    Cursor employee is
    SELECT EMPLOYEE_ID,EMPLOYEE_NAME from eldoret_final;
    BEGIN
    for e in employee loop
    fnd_user_pkg.createuser
    x_user_name => e.EMPLOYEE_NAME
    *,x_owner => ''*
    *,x_unencrypted_password => 'welcome123'*
    *,x_start_date => SYSDATE - 10*
    *,x_end_date => NULL*
    *,x_description => 'CBK Employee'*
    *,X_EMPLOYEE_ID => e.EMPLOYEE_ID*
    fnd_user_pkg.addresp(upper (e.EMPLOYEE_NAME),'PER', 'CBK_EMPLOYEE_DIRECT_ACCESS','STANDARD', 'DESCRIPTION', sysdate, null);
    end loop;
    commit;
    end;
    I had first created the user JOCHIENG and assigned it the responsibility for Self service. So the script just assigns the responsibilities by copying from the one assgined to this user.
    Everything seems ok. However, when trying to log in as the new user, the login error: Login failed. Please verify your login information or contact the system administrator.
    is returned. But I can reset the password using the forms under Security > Define. Even with the correct password, the login doesn't go through.
    Any idea?
    dula

  • How to create RFQ s and use them to complete the program

    hi,
    how to create RFQ s and use them to complete the program
    thanks in advance

    Hi Santosh,
    RFQ is created through transaction ME41.
    You need to write down BDC for mass update of RFQ, because BAPI is not available.
    Regards,
    Tutun

  • Create handling units and assigning them as Packing Proposal for Sales Orde

    Hi Friends
    How to create handling units and assigning them as Packing Proposal for Sales Order Items in the background.
    Could you please help to provide Input Parameters for BAPI_HU_CREATE for sales order OR is there any other program creating and assigning them to Sales Order line Items.
    Thanks in Advance.
    SR

    Hi Friends
    I created Handling Units with BAPI_HU_CREATE , Pack materials with BAPI_HU_PACK in to Handling Untis and assign handling units to sales order with BAPI_HU_CHANGE_HEADER . But These BAPIs are not doing packing sales order line items in to handling units . I have to go sales order and do sales order line item packing by clicking packing button.
    Could you please help on how to do packing Sales Order Line items in the background with BAPIs.
    Thanks in Advance.
    SR

  • HT1338 I can create bookmarks folders and populate them. but when i quit safari the folders disappear?

    I can create bookmarks folders and populate them. but when i quit safari the folders disappear?
    Please  help

    Hi Nick ...
    Try deleting the cache and reset ...
    From your Safari menu bar click Safari > Empty Cache
    If that doesn't help, back to the menu bar, click Safari > Reset Safari. Select the top 5 boxes, click Reset.
    If that didn't help, try troubleshooting the Safari .plist  (preferences)
    Quit Safari.
    Go to ~/Library/Preferences
    Move the com.apple.Safari.plist file from the Preferences folder to the Desktop.
    Relaunch Safari.
    If it's working ok now, move that .plist  file to the Trash. If not, move it back to the Preferences folder.
    If you have trouble finding those files, open the Finder. From the Finder menu bar top of your screen, click Go > Go to Folder
    Type this exactly as you see it here:   ~/Library/Preferences
    Click Go

  • Creating dynamic sized arrays and filling them automatically on speedy 33

    hi all,
    I am trying to create dynamic sized arrays on Speedy-33. Specifically, depending on the user input, I want to be able to create
    arrays with 128 or 256 elements and fill them automatically. However,
    array constant element is fixed for Speedy 33; thus I have to manually set the
    size of the array with the mouse and enter the values in to the array by
    myself. I want to make this tedious process automatic. Would this be possible? thanks so much for comments!
    ~casiopea

    Casiopea,
    There is a really great article on using arrays with LabVIEW DSC which can be found here:
    How Can I Be Successful With Arrays In the LabVIEW DSP Module?
    One of the biggest things that should be noted about DSP is that there is no dynamic memory allocation.  Your array size must be fixed, and thus, your array needs to be initialized by using a constant. 
    An easy way to initialize an array constant that has many elements that are all the same is to simply create a numeric constant that has the value that you want.  Then, create a new blank array constant and drag the numeric into it.  In the index input for the array constant, type in the index of the last element that you want to be initialized.  Then type in the value in the element that is displayed and all of the elements before it will be initialized to the default value of the numeric constant that you dropped into the array constant.  I hope this helps.  I would really recommend reading through that article, as it has a lot of great information about using arrays with DSC.
    Brian Coalson
    Software Engineer
    National Instruments

  • Need help creating custom objects and adding them to an array.

    Hi Everyone,
    So I'm dinking around in Powershell today and I'm failing at creating an array of custom objects.  I want to create a HTML report that builds out after every MDT image update. To do that, I need to collect my data on what's contained in each build.
    Here's my current script in progress -
    function Parse-Dependents($fullname){
    #PARAMETER SWITCHING
    if(!($fullname)){
    $dependents = get-dependents
    if($fullname){
    $dependents = get-dependents -fullname $fullname
    #SPIN THROUGH ARRAY OF GUIDS FROM GET-DEPENDENTS
    foreach($d in $dependents){
    #SPIN THROUGH EACH APP IN APPLICATIONS.XML
    foreach ($app in $apps){
    #IF MATCH THEN ADD OBJECT WITH PROPERTIES
    if($d -match $app.guid){
    #ADD APPLICATION MATCH TO THE ARRAY
    $applications = @{
    'Name' = $app.ShortName;
    'GUID' = $app.Guid;
    'Version' = $app.Version;
    'Last Modified Time' = $app.LastModifiedTime;
    'Last Modified By' = $app.LastModifiedBy;
    'Install Directory' = [string]'\\my\path\to\MDT\' + $app.WorkingDirectory.TrimStart(".","\")
    'CommandLine' = $app.CommandLine;
    new-object -typename PSObject -property $applications
    #RETURN MATCHED ARRAY
    return $applications
    It all works great until I look at my output and see that I get my expected properties and array, but at the end it's created additional empty entries for each of my initial properties I assigned.  So I get my list of apps like this :
    powershell.ex... OrgChart Plugin  \\my\mdt\server\ XX\user                     9/22/2014 5:... {ffee7497-0c...
    And then below it :
                     CommandLine                                                                                    
                     Name                                                                                           
                     Install Direc...                                                                               
                     Last Modified By                                                                               
                     Version                                                                                        
                     Last Modified...                                                                               
                     GUID                                                                                           
    And these are all listed under the Name property.  I'm still pretty new to PS (8 months or so now), and rarely have to create a custom object, but this seems like a case for doing so to create a custom html report.  Any ideas would be greatly appreciated.
    Ryan

    It's not really all that strange.  
    If you look at your script, you're not outputting the hash table until both loops finish.  The values are dependent on the properties of the $app objects enumerated in the inner loop, and only outputting an object if the dependent ($d) matches the $app
    guid property.
    At the end, you're outputting the hash table without that test, so it's going to have values based on the last $app in the loop, regardless of whether the guid matches the dependents or not.
    [string](0..33|%{[char][int](46+("686552495351636652556262185355647068516270555358646562655775 0645570").substring(($_*2),2))})-replace " "

  • Profiles created with SU02 and transporting them

    We have a lot of profiles that were created with SU02.
    When I change them in our Development system and then create a transport and move the transport to our quality system and our production system the changes do not get updated.
    I manually go to each system with SU02 and make the changes again and activate them.
    Is there another way or am I missing something.
    Thanks
    Joe

    Julius,
    The TCD field isn't causing confusion.  Look to the left at that Z:MC40 or whatever.  That's the auth object, which has a field called TCD.  In other words, there isn't S_TCODE with field TCD, there's this Z:MC40 or whatever, with field TCD and the tcode in that filed is MC40 or whatever.
    Anyway, if I go through my data for S_TCODE, then I find that in the profile, it refers to the following.  Note that these are the only two profiles in my UST10S table that refers to S_TCODE.  I need to figure out how to reconstruct the rest of the profiles into roles so that the unlimited access in these profiles below can be removed and the balance of the profiles can be given relevant transactions.
    X:TCODE        S_TCODE     &_SAP_ALL
    X:TCODE             S_TCODE     S_TCD_ALL
    X:TCODE             S_TCODE     S_TCD_ANW
    X:TCODE             S_TCODE     S_TCD_BC
    X:TCODE             S_TCODE     S_TCD_CUST
    X:TCODE:ALL     S_TCODE     &_SAP_ALL
    X:TCODE:ALL     S_TCODE     S_TCD_ALL
    X:TCODE:ALL     S_TCODE     S_TCD_ANW
    X:TCODE:ALL     S_TCODE     S_TCD_BC
    X:TCODE:ALL     S_TCODE     S_TCD_CUST
    Edited by: Santosh Krishnan on Jun 30, 2010 1:23 PM
    Edited by: Santosh Krishnan on Jun 30, 2010 1:24 PM

  • Creating Chapter playlists and deleting them

    I'm trying to learn how to play a whole video with one manu button and play chapter of the same video with chapter buttons.
    I see it posted here in several places that one needs to make a chapter playlists for each chapter.
    But that I guess it means if you have 4 chpters, to do:
    file/new/create new playlist, 4 times. And put one chapter on each.
    I found creating them is easy but made mistakes on them once created like inadvertantly adding a second chpter. I managed to do this several times on several different playlists. I see no way to get rid of them. Or even see them. Once a new one is created where do the others go?
    window/playlist viewer shows a screen that says there are no playlists but the end action list shows several of them as does the `work flow' view.
    Niether place appears to offer a way to delete or edit them.

    Harry Wrote:
    > Now my chapter buttons fail.. I see no way to set an end action for them now
    Jeff replied:
    > Are you talking about the buttons in the menu or the chapter markers in the timeline? You set end actions for the chapter markers in the timeline.
    > Double- and triple-check that no overrides are set.
    > If my method is giving you a headache trying to figure it out and you find yourself spending more time than you'd like, perhaps your original method of using one chapter playlist per chapter and no chapter end actions at all would be a better solution for you. As I said before, they are functional equivalents on the finished disc.
    Buttons in the menu...
    No it wasn't your method which seems like a good one.
    Its more a problem of deep seated stupidity here.
    I Previewed from a chapter button but let it finish (it was a very short chpt) instead of hitting the `end action' button.
    When one lets the previewer finish, it just stops, never returning to menu.... my error.
    But still I thought I remembered the chapter buttons having end actions available in previous attempts here. I see I've confused what one sees in proprerty screen when clicking a timeline in project windo w with what one sees in properties window when clicking a button.
    Of course it is the timeline played by a button that has an `end action' not the button itself.
    Thanks for taking the time to help... I think I might have it now.

  • Problems creating new project and ringtone

    Hello everyone. I recently tried to create a new ringtone using GarageBand v5.0.2 and I ran into a problem. I clicked on iPhone Ringtone on the left hand side but there's nothing on the right and when I click on the Choose button, nothing happens. So I tried to create a new project instead. I clicked on New Project on the left, nothing shows up on the right, and when I click on Choose, nothing happens. Learn to Play, the Lesson Store, and Magic Garageband all seem to be working okay. So does Recent Projects.
    Any thoughts as to why this is happening to me? Or offer up a solution, maybe? Thanks in advance.
    -Bruce

    Never resolved

  • Create OID Atributtes and turn them availables to portal environment

    Hi, i´m synchronizing AD (Active Directory) with OID and i´ve need to create some new attributes on OID, using ODM, because they exist on AD and will be synchronized.
    The question is, will those new attributes available when i create a new user, through OIDDAS? What do i need to do to turn them available, case negative?

    Yes it's possible to expose attributes in OIDDAS
    cf http://download-uk.oracle.com/docs/cd/B14099_11/idmanage.1012/b14086/ssc_admin.htm#i1057304

  • Error Creating reusable subprocesses and transform them into BPEL

    I have a reusable process
    startevent-automated activity1-automatedactivity2-end event
    I have a main process:
    startevent- automated activity"step 1"-subproces step 2 (type =independent, reference to subprocess)-automated activity "step3"-end event
    When I transform the subprocess, it is successful. Then I transform the main process. it gives me the error "subproces step2 should have a start event and an endevent. It will not open in BPM Studio".
    The start and end event are there. Am I missing something here?
    Regards,
    Lonneke

    I figured out the problem: if I want to create a reusable subprocess in BPA Suite, I need to create a 'regular function' (not an automated activity) and assign it to the subprocess. Then it is transformed without any errors.

Maybe you are looking for