Optimization help: use another algorithm?

I have a program that generates and uses three dimenisional array (dimensions 256*256*256). However it takes more than 80 seconds to run just this block of code
Basically all it does is pick a pesudo-random sample using only one inital random value. kind of like in winamp when selecting 'random' play mode.
i would like to know if there is a much quicker algorithm than what i currently have.... and also if at all possible given a sample (say of size 255) get the random number that generates this sample?
here is the code:
int[] og = new int[256*256*256];
temp =randomFloatNumber*16777216+16777216;
rnd =(int) temp;
System.out.println(rnd);
for (int i=0;i<(256*256*256);i++)
og= i;
for (int i=0; i<(16777216);i++)
pos=(pos+rnd)%(16777216-i);
b1=og[pos]/65536;
b2=(og[pos]-b1*65536)/256;
b3=og[pos]-b1*65536-b2*256;
groupCount[b1][b2][b3]=i/255;
groupCount1[b1][b2][b3]=i-groupCount[b1][b2][b3]*255;
og[pos]=og[16777215-i];
if (i%167772==0)
System.out.println(i+"/16777216");

Your specification could be more precise. For example, what defines a "group of three bytes"? Is (data[0], data[1], data[2]) the first, (data[1], data[2], data[3]) the second, and so on? Is order within a group important? What to do if the top 254 are not precisely determined? And by "the seed value that will generate these groups", do you mean an integer j such that Random rand = new Random(j);
int[] groups = new int[254];
for (k = 0; k < groups.length; k++)
    groups[k] = rand.nextInt(1 << 24);
}will fill groups with the corresponding three-byte groups in order of occurrence in the original data set?

Similar Messages

  • Tried charging my 2009 MacBook Pro but the green light won't turn on and now my computer won't turn on (it was working right before I attempted to charge it!) what do I do????? Even tried using another charger I had for it and nothing! Help

    Tried charging my 2009 MacBook Pro but the green light won't turn on and now my computer won't turn on (it was working right before I attempted to charge it!) what do I do????? Even tried using another charger I had for it and nothing. No green light. Computer turn on. Now what??? Help!

    QUOTE: "No green light. Computer turn on."
    What? so were you able to turn on the computer with the new plug? does it give you any other light? amber/orange light?

  • Hello i forgot my i cloud password..anyone can help me to find my password.i already make a new apple id..but my icloud use another account..so how to reset my iCloud account plz hel me

    hello i forgot my i cloud password..anyone can help me to find my password.i already make a new apple id..but my icloud use another account..so how to reset my iCloud account plz hel me

    Making a new Apple ID is not a good idea, since you have to reset the password for that Apple ID anyway. All of your purchases are tied to the Apple ID that the iCloud account was created under. So, you have to retrieve the password for that Apple ID in order to sign into iCloud anyway.
    Go to Manage your Apple ID, and click on the Reset Password option (Apple - My Apple ID). Sign on with the Apple ID that the iCloud account was created under, and answer the security questions. If you do not remember the answers to the Security Questions, contact Apple Support to have them reset:
    ACCOUNT SECURITY CONTACT NUMBERS
    Cheers,
    GB

  • I have purchased new iphone 3gs, its usb cable and charger not working.When I plugged in usb cable to my laptop it says"usb power hub exceeded". When I use another cable I have, it works fine.But the original one not working.Any help?

    I have purchased new iphone 3gs, its usb cable and charger not working.When I plugged in usb cable to my laptop it says"usb power hub exceeded". When I use another cable I have, it works fine.But the original one not working.Any help?

    Are you connecting your iPhone directly to your PC or to a USB hub?

  • TS2998 Help! My Mac mail uses another person's name in stead of mine in the "from" heading when trying to send e-mail. How can I fix this?

    Mac mail started using another person's name instead of mine. In the "From" line it shows someone other than me so the receipient will not know I am sending them an e-mail. HELP!, This is crazy. Is there a fix?

    Does this problem happen EVERY time you send an email?
    Do you see the wrong FROM entry before you hit the send button? Or does the recipient report seeing another name other than yours?
    Do you recognize the incorrect name being shown? Is it something you or someone else using your machine have ever used? Is it a name you have never heard of before?
    Go to your SENT folder in Apple Mail. What do you see when you open one of your SENT emails, in the FROM slot? Is the name correct or incorrect?
    Also, I don't understand your comment "I noticed it when I try to send a link via e-mail to another person." are you saying that when you paste a link into an email to someone that your name in the FROM field changes? Where are you putting the link, in what place in the email?

  • I used another computer to get music and now their account is not allowing me to add music onto my ipod from my computer... please help!

    I used another computer a while back to get music and now their account is not allowing me to add music onto my ipod, from my computer, on my account.

    What computer did yu last sync with?  Yu can only sync with one computer/iTunes library.
    You can however manage musiic amon different computers.
    Using iPhone, iPad, or iPod with multiple computers
    If you need more help please provide more detail on what youd have done and tried on both computers.

  • HT1911 I have reset my Apple ID & Password but I still cannot access the music I purchased using another computer, ID & PW. It keeps saying that my computer is not authorize to play the songs. I have tried everything and nothing seems to work. Help!

    I have reset my Apple ID & Password but I still cannot access the music I purchased using another computer, ID & PW. It keeps saying that my computer is not authorize to play the songs. I have tried everything and nothing seems to work. Help!

    iPod touches or any iDevices from Apple sync only to one computer. If you sync to a different computer, all your music will be replace with the music from the new computer's iTunes. If the music were purchased from iTunes, you can re-download them again otherwise the music on iPod touch will be deleted. Do you have iTunes backup? 

  • HT5622 Today I tried downloading an app from the App Store and after entering my Apple ID it says this Apple ID Connor be used In The iTunes Store please use another Apple ID. Weird since I am in the App Store so body help

    Today I tried downloading an app from the App Store and after entering my Apple ID it says this Apple ID Connor be used In The iTunes Store please use another Apple ID. Weird since I am in the App Store sombody help

    I have the same issue.  I try to download an app from the App store on my iPhone 5, and just says that I can not use that user ID to purchase from iTunes.  I saw a couple of threads that this might be an apple issue?  Not sure though. 

  • Am using another laptop with older ffox. Desktop updated to ff 5 yesterday and now crashes so soon that I can't complete the process of seeking help on that machine

    using another PC because ffox 5 crashes so quickly and frequently that I can't complete this reporting process on the other machine. The signature code that appeared was nahojit:CodeAlloc::addMem()
    and one of the Crash IDs is shown below - I h ope I have copied it correctly.

    Triple-click anywhere in the line below to select it:
    { diskutil list; echo; diskutil cs list; } | open -f -a TextEdit
    Copy the selected text to the Clipboard (command-C).
    Launch the Terminal application in any of the following ways:
    ☞ Enter the first few letters of its name into a Spotlight search. Select it in the results (it should be at the top.)
    ☞ In the Finder, select Go ▹ Utilities from the menu bar, or press the key combination shift-command-U. The application is in the folder that opens.
    ☞ Open LaunchPad. Click Utilities, then Terminal in the icon grid.
    Paste into the Terminal window (command-V).
    A TextEdit window will open with the output of the command. Post the contents of that window, if any — the text, please, not a screenshot. The title of the window doesn't matter, and you don't need to post that.
    If any personal information appears in the output, anonymize before posting, but don’t remove the context.

  • I created a slide show on work computer. Placed photos and movies in Media Browser. Want to use another computer (laptop) to give presentation. Do I need to copy media browser to laptop or are pictures and movies embedded in slide show and can go anywhere

    I created a slide show on my work computer and placed many photos and movies in my work computer's Media Browser. Want to use another computer (laptop) to give the presentation and therefore change location of slide show. Do I need to copy the media browser to the laptop or once the pictures and movies are embedded in the original slide show, can I take it anywhere and not worry about the media browser?
    I also want to optimize a movie for Keynote, so it's not too large a file. Please help.

    Graphic, sound and video files are copied into the Keynote file, but make sure Keynote > Preferences - include sound and movies check box is ticked.
    If you have added additional fonts they will need be changed to reflect what is on the destination machine.
    If the other machine has a different Keynote version, ensure the same transitions and effects are available.

  • My weather app in my iphone4 is suddenly using another location than mine, one from another state. Tried resetting my location, but no go.

    The factory installed weather app on my iphone suddenly has started using another state as my location. I tried resetting my location several times, but no go. Any ideas how to fix this?

    Have a look at this it may help
    http://support.apple.com/kb/TS4148
    please confirm
    You did purchase your unlocked iPhone4S from an Apple Retail store and I mean the Apple Store no where else sells unlocked iPhones in the UK regardless of their claims

  • Firefox seems to be my only browser that puts ads on my Facebook page. How can I stop this? I love Firefox but hate the ads and will use another browser until it's solved.

    Whenever I open Facebook through Firefox I get pop up ads and such. I do not seem to get this when using other browsers like Safari or IE. It's sooo annoying!!! I will use another browser until it's solved.

    Since you have encountered the problem at other sites, not just Firefox, I'd bet that it is an Internet Explorer problem, not the web sites. Actually, I am sure it is an IE problem.
    Try running Windows Update, perhaps there are some updates for Internet Explorer that might resolve the problem. If you don't know how to run Windows Update, use the Help on your system to look for information on Windows Update.
    If that does not help, use Google to search for information on IE9 locking up when downloading.
    Stan

  • Black Screen - Get Chime - Can Boot off HDD using another Mac - iMac 24in.

    Hope someone can help me here, as I'm at my wits end.
    I've got two issues, one with my MacBook Pro 17in, 4GB RAM, 160GB 7200rpm (2008) and another with my iMac 24in. 4GB RAM, 500GB 7200rpm (2009).
    Firstly the MBP, left work on Thursday last week, got home, powered up the MBP and got a black screen!!! Tried resetting PRAM, SMC, booting in safe mode, removing and re-installing RAM, removing battery and mains power and leaving off overnight etc etc, yet nothing happens. Benn all over the forums and have not found any solution to get my beloved MBP working on it's own. I can boot off the HDD using another MBP 15in, re-install Snow Leopard and as far as I can tell the HDD is fine, as I have run disk utility and it tells me the HDD is OK.
    I can't figure this out and it's doing my head in, as I use this laptop for business use and just can't afford to go out and buy another Mac. I should point out that this MBP never had any issues when running on Leopard, but ever since I upgraded to Snow Leopard, I have had nothing, but trouble. I did a clean install, in fact I have done it at least twice, even erasing the HDD securely, both at 7pass and 35pass, yet I have had permissions issues regularly and on the odd occasion, I have also had the problem of the HDD not being recognised.
    The iMac is nearly the same, but the screen is working, although the iMac doesn't see the HDD no matter what way I do, again, reset PRAM, SMC, safe boot etc etc. In truth the iMac has been a lot more unreliable, but with the screen working, if I can get any solutions here, then I'll be working to work on that without the need or hassle of working via another.
    I think that the MBP is only just still under warranty, but the iMac definitely is, but I need at least one working for business use, so really only want to let Apple have one at a time to look at/repair etc.
    Ideally, as the HDD is working in the MBP, if I could get a solution to the black screen issue, then I could do without the iMac for whatever time it takes, so if there is anyone out there that can help, I'd be so grateful.
    One last thing, when I bought the iMac 24in., I also bought an iMac 20in., but I never upgraded the 20in. to Snow Leopard and to this day, it has worked flawlessly, without a single issue ever.
    Perhaps, I'm getting paranoid here, but there seems to me to be a link between the ongoing and regularly occurring problems with both Macs ant the upgrade to Snow Leopard. Why also, or is it just pure unadulterated coincidence that both the MBP and the iMac 24in have failed at pretty much the same time??!!!!
    I'm going mental here, so I hope someone out there has a better fix, then me overdosing on Prozac!!
    PS
    I'm not a mac expert, not good with a soldering iron either, but I'm capable of following good instructions.

    Using Snow Leopard forum is probably your best bet.
    I don't care if someone has 20+ yrs, I still like having a good troubleshooting book/manual handy.
    Mac: can't get by without bootable backups, even if you use TimeMachine, clone your system. Save you all this fuss and work.
    Then invest in high quality disk repair and maintenance program.
    Disk Warrior / TechTool Pro 5 / Drive Genius 3 - top 3 probably
    There are always going to be normal items you just ignore with Repair Permissions. Useful to do once in a while but not magic. Same with SMC and the rest. Running disk repair is one of those things that it seems should be done before there is trouble, not after, and a weakness in HFS file system and disk directory.
    Apple Support is a good place to start looking and then hardware category.
    http://www.apple.com/support
    http://www.apple.com/support/imac /macbookpro etc
    Make sure all your software is current, don't install anything you are unsure of or can do without.
    Run Apple Hardware Test off your OEM DVD specific to the Mac.
    Now, have you Googled for this?
    have you looked at reports about 500GB drives used in some Macs that had issues and were offered firmware update for the drive?
    Considered just using another drive connected to iMac?
    You can overheat a hard drive with needlessly running 7 and 35-write pass, besides which the best way to map out bad blocks is not Disk Utility.
    http://www.bing.com/search?q=imacblackscreen
    http://www.bing.com/search?q=AppleiMac+firmwareupdate
    I'd direct your replies to iMac and MacBook Pro as well as to Using OS X Snow Leopard areas.

  • I have an icloud email account that my spouse used and he is gone now, can I delete this one and use another or will this delete information?

    I have an icloud email account that was set up by my spouse and I am trying to get rid of everything with him on it due to the nature of the split and want to make sure he can never access the childrens and my photots, music, etc. 
    In this I wanted to change the email address in icloud so that I no longer get his emails from his contacts, friends, etc.  I made an alias but is there anyway to delete this icloud email address and use another or will this delete all of our data?
    New at this icloud and its real cool but afraid to lose all my information. 
    Help!

    Welcome to the Apple Community.
    Deleting the account from the phone will do only that! it won't affect any other information on any other device.

  • Using another web browswer until you get rid of Firefox 4. What a disaster! When do you plan to fix it.!!!

    What a nightmare Firefox 4 have been. I have warned everyone else not to upgrade to this horrible browser. Which is sad, since I used to recommend it to everyone. I don't like IE or Safari, but I like them better than Firefox 4 so I will be using another browser until you fix whatever it was you did to the new update. Very inconvenient to have to change all my bookmarks and info that I have used on Mozilla since it first came out. I hope you are working on it since there is page after page of similar responses. When can we expect this to be fixed?
    Lori
    Why do I have pop-up everywhere now, my home page changed, I have some stupid mp3 toolbar installed(which I will get rid of). What were you guys thinking?

    Hello,
    You'll have to be more specific. Do you know the name of it? If not, go to your '''about:support''' page by entering it in your address bar and pressing enter, or going to:
    * Help (or [[Image: New Fx Menu]] > [[Image: Help-29]]) > Troubleshooting Information
    Then click "Copy Text to Clipboard" and paste that information here.
    If you don't have many extensions and don't mind going to download them and setting them up again, you can '''Reset Firefox'''. The Reset Firefox feature can fix many issues by restoring Firefox to its factory default state while saving your bookmarks, history, passwords, cookies, and other essential information.
    '''''Note:''' After resetting Firefox, you will lose any extensions, toolbar customizations, and some preferences.'' See the [[Reset Firefox – easily fix most problems]] article for more information.
    To Reset Firefox:
    #Click the menu button [[Image:New Fx Menu]], click help [[Image:Help-29]] and select ''Troubleshooting Information''. A new tab containing your troubleshooting information should open.
    #*If you're unable to access the Help menu, type '''about:support''' in your address bar to bring up the Troubleshooting Information page.
    #At the top right corner of the page, you should see a button that says "Reset Firefox" that looks like this: [[Image:Button reset]]. Click on it.
    #Firefox will close and reset. After it is done, Firefox will show a window with the information that is imported.
    #Click Finish and Firefox will reopen.
    Did this fix the problem? Please report back to us!
    Thank you.
    EDIT: How did you update your Firefox? If you downloaded a new copy but didn't download from the official Mozilla website:
    * https://www.mozilla.org/en-US/firefox/new/
    * https://www.mozilla.org/en-US/firefox/all/
    Then you will need to uninstall and reinstall Firefox by downloading a new copy from one of those two links.

Maybe you are looking for

  • Terms and conditions not getting displayed on the last page

    Hi All, I have to display a smartform, on the front side of the page i have to display material details and on the back side of the page i have to display terms and conditions. I' am unable to print the material details and terms and conditions in du

  • HOW TO DELETE DUPLICATE ELEMENT IN A VECTOR

    Hi everybody! If I've a vector like this vectA={apple,orange,grape,apple,apple,banana} and I want final result be vectB={apple,orange,grape,banana}. How should I compare each element in vectA and delete duplicate element. Like here duplicated element

  • MS-6368 Mainboard display Shaking

    I have 5 mainboards model MS-6368 socket 370, and they have the same problem with VGA, they show all time shaking the display, I try to put one PCI-vga CARD, and the system don't start-up. Please, if someone help... Thanks Giuseppe Mayorga

  • Problem with disc crash

    My iMac's disk crashed yet again. Sometimes during software updates, the mac doesn't respond at all, and after a while, I just manually shut it down via the power button in the back. Now sometimes this results in my mac not booting (It stays on the g

  • Needed help in greying a out a field in mb21

    hiii experts, i have got a requirement of greying out a field in mb21... the field is GL Account because sometimes users puts a GL in the entry and wrong GL is got hitted .... please provide steps how to do that.. providing a screenshot the field whi