Does Random with zero seed work ?

halo everyone..
i am new to this site.. and im very new to java too.
anyways.. i am so stomped.. how can i make a
random constructor to accept a zero seed and still
generate a random number ?
coz when i try like
Random generator = new Random(0);
all my generated integers stay the same..
not random at all.
i tried to use DecimalFormat to try and work around
this problem.. but still it doesn't work for me. i would like
to know if this is possible to have zero seed. thanx

You must be using it incorrectly. You're probably doing something like this: for (...) {
    Random rand = new Random(0);
    int value = rand.nextInt();
} You need to do this: Random rand = new Random(0);
for (...) {
    int value = rand.nextInt();
} Or, if rand is a member variable in your class, make it static, so all instances share the same Random.
If you create multiple Randoms with the same seed, they'll all have the same sequence of pseudorandom numbers. If you only use each one once, you'll always get the first number in that sequence.

Similar Messages

  • Does UIBackgroundModes with key "voiceip" working in air 3.4?

    does <UIBackgroundModes> with key "voiceip" working in air 3.4?
    setKeepAliveTimeout() available too?
    If it works, how to config it?  So, i can forget APNs, receive message from server and use a local notification instead.

    Nope. The Flash roadmap says 2013.

  • Does JDeveloper9i with OA Extension works with OA 5.7

    I have installed JDeveloper9i with OA Extension from path#4045639 and it seems like it is designed to work with OA Framework 5.10. In our DEV instance environment it is currently set to 5.7 . What should I do to customize and test XML pages? should we upgrade this to OA 5.10 Framework
    Thanks in advance for your feedback

    OAF only works 11.5.10 or 11.5.9 patched to to correct level of FND and FWK. Please search Metalink for the patches required or log a TAR with Oracle Support for this information.

  • Compression with zero-elimination

    Hi experts,
    "If you want to avoid the InfoCube containing entries whose key figures are zero values (in reverse posting for example) you can run a zero-elimination at the same time as the compression. In this case, the entries, where all the key figures are equal to 0, are deleted from the fact table"
    I am looking for clarification regarding the note above.
    I understand that Compressing the InfoCube eliminates the duplicate records by converting all request IDs to 0 and rolling up the key figures for records that have common values for all characteristics
    If I have 1 record with more than 3 KFs for example; within those 3 KFs, 2 have the value 0.
    Does compression with zero-elimination with only set the request id to 0, keeping the value 0 for the 2 KFs like before compression or do we will have blank space (deleted) insteadt?
    Does the zero-elimination is only possible when all KFs in the same record are equal to 0?
    Thanks.

    Hi Blaiso ,
    Zero Elimination means deleting the record from the cube after compression if and only if, the entire key figures of the particular record is zero. If there are two key figures A & B, A = 0, B = 10, then this record will not be deleted from the cube.
    So the answer to your question is if in a particular record there are 3 KF with 1 as non zero then this record will not be deleted but request ID would be deleted .
    Please check the below link for complete information on compression :
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/c035d300-b477-2d10-0c92-f858f7f1b575?QuickLink=index&overridelayout=true
    Hope it helps .
    Thanks
    Kamal Mehta

  • Since updating to LR5.5 it crashes about every 5-10 images while working in the development module. Computer is PC Windows 7 Home Premium. I have been using this computer for several years with zero problems. Is this related to the updating? What is the f

    Since updating to LR5.5 it crashes about every 5-10 images while working in the development module. Computer is PC Windows 7 Home Premium. I have been using this computer for several years with zero problems. Is this related to the updating? What is the fix?

    Do you get an error message? If so, what does it say?
    Do you get a Blue Screen?
    Does something else happen?

  • Why Won't Hunspell Work With Zero Width Spaces?

    Hello,
    I was excited to hear that Hunspell dictionaries are now supported in InDesign CS5.5 and I was able to try it out for the first time today.  Unfortunately I ran into some problems when using a dictionary for Khmer (the language of Cambodia - UTF-8 - using the World Composer).
    Khmer does not have spaces between words, and so to get around this issue (for line breaks as well as spelling/grammar checking), we use zero width spaces between words (U+200B).
    The Khmer Hunspell spelling checker dictionary works with zero width spaces in OpenOffice (http://extensions.services.openoffice.org/en/project/khmersbbic - I am the lead author of this Khmer spelling dictionary), but in InDesign (I manually added the dictionary - InDesign uses the Khmer dictionary files fine), the zero width space is not seen as a space that denotes a break between words, therefore words that are correctly spelled are jumbled together as if there are no spaces between them.
    Does anyone know how to get InDesign to recognize a zero width space to be a word seperator for spell checking purposes?
    Example of sentence correctly spelling using zero width spaces between words (But this is viewed as one long word in InDesign): បើសិនជាអ្នកចង់ទៅយើងអាចទៅបាន។
    Example of same sentence with words sperated by "real" space which then allows the Hunspell based Khmer dictionary to correct spelling but makes the text unuseable because Khmer does not have spaces between words): បើ សិន ជា អ្នក ចង់ ទៅ យើង អាច ទៅ បាន។
    Any help would be much appreciated.  I have already submitted a bug report to Adobe, but not sure how much that will help.
    Thanks again,
    Nathan

    Make a character style with the Horizontal scaling set to 1%, and replace your zero width spaces with a regular space and this character style. That way your own spaces will be unharmed.
    nathanwells wrote:
    The only issue is that in a book of 400 pages, 1% might actually add up to something.
    Yes, that's a possibility. However, I suppose your text, even though in Khmerian, is divided into lines and paragraphs and pages as usual, so the chances of actually changing even a single page break are pretty slim.

  • How does random work

    I need to know how random works in a smart playlist.  I was a user of Itunes DJ and loved the feature play higher rated songs more often.  Itunes 11 removed this wonderful feature.   in order to work around this i created a parent smart playlist and 5 sub-playlists.  I made one list which has only my 5 star songs, then a list with all the 4 and 5 star songs, then a list with all the 3,4,5 star songs , one with 2+ and one with all music.  I have the parent list with 200 random selections from ANY of the 5 playlists.  My question is does random first randomly select a playlist and then randomly select a song, or does random take a selection from all the songs in all the playlists.  i.e., each song only has 1 chance of being selected.  My intenetion was to have a 5 star song have 5 chances at being selected and a 1 star song having 1 chance of being selected.  To keep the list refreshing I removed any song which has been played or skiped in the last day on the parent list and each sub list. 

    Ok I have messed around and taken samples after changing the limit of how many songs in each list.  I can select 5 on each list except for the 5 star only where i put in 80.  I still get the same results, about 2-3 5star songs out of the 100 songs in my random DJ smart playlist.  Here is how it is set up
    1star and higher (all 64,000 songs)
    2star and higher (60,000 songs)
    3star and higher (50,000 songs)
    4star and higher (7500 songs)
    5star (1400 songs)
    The Random DJ list is limited to 100 songs.
    My Random DJ list matches ANY of those playlists with no songs played in the last 1 day.
    I have tried with no limit on each of the sublists, a ratio limit (i.e. 640 1 star, 600 2star, 500 3star , 75 4 star, 15 5 star), and I have also just tried limiting like you said 10,20,30,40,50.  No matter what i put in the limit field of the sub lists my Random DJ picks about the same number/ratio of rated songs.  So It is just picking a random song from my entire list.  I guess that how random works is it first decides the pool of available songs and then random picks one.  It does not , how i hoped, pick a random playlist and then select a random song.  IS THERE ANYBODY WITH A PLAYLIST THAT DUPLICATES PLAY HIGHER RATED SONGS MORE OFTEN? 
    I really hate apple removed this feature without adding a smartlist or a tutorial on how to get the functionality back.  I USED IT EVERY DAY AND HAVE NOW SPENT HOURS AND HOURS TRYING TO DUPLICATE.

  • How does Creative Cloud for teams work with staff who work in two locations ie in the office/home

    How does Creative Cloud from teams work with staff who work in two locations i.e. in the office and home?

    There is no difference please be aware that each login is provided with two activations however.  If you wish to have a computer at both work and home activated though that is perfectly fine as long as your employer is ok with using company software at home.

  • Hey Guys, from Germany. I want to connect my iMac 21" with my Tv just for fun. Does anyone know, how it works. With a Hdmi adapter?

    Hey guys! I want to connect my Imac 21 " with my Tv just for fun. Does anyone know , how it works?

    Selecting the correct adapter and cable depends on which year model iMac you have and what inputs the TV has?
    Check the User's Guide that came with your iMac or your Spec's at > Apple - Support - Technical Specifications
    to see if your iMac has a Mini-DVI or Mini DisplayPort and then select that adapter with the correct connection for the TV.
    Example: if you have a 2010 or 2011 iMac and an HDMI ready TV, then you would want the > Moshi Mini DP to HDMI Adapter with Audio Support - Apple Store (U.S.)

  • Autofill in Google Toolbar does not appear to be working with Firefox 4 - Aways saying Autofill not available for this page even on pages I have used it before FF4 upgrade

    Autofill in Google Toolbar does not appear to be working with Firefox 4 - It aways gives the message "Autofill not available for this page". This is happening on pages I have used Autofill on before upgrading to FF4 from Firefox 3.5.x

    i did not see a solution posted - I tired what I read. Going back to an old version may solve the problem but it is a stupid solution so I have yet to do that.
    I am on version 4 and autofil this does not work :
    Popular answer Go to this answer
    Uninstall version 5, then Google "google toolbar version 4", follow the link to FileHippo.com, and download and install the last version 4. When you reinstall it, make sure you turn off the option to perform automatic updates.
    6 of 7 people found this answer helpful. Did you? Sign in to vote. Report abuse

  • How does RFC adapter with EO/EOIO work? Kindly help!

    Hi Experts,
            How does a sender or receiver RFC adapter works when QOS is EO or EOIO (Async)? In other words, for EOIO, are the messages are queued? How does this queueing work? Does it use FIFO logic? where do we specify the max limit of messages that can be queued?
    Also what is the significance of 'Initial connection' and 'maximum connections' in communication channel? I have given the default value 1 for both. What should be the ideal value and why?
    In my Async RFC - XI scenario sometimes XI is able to receive the messages but sometimes it doesnot even though the sender system is UP and running.
    I cannot see any messages in SXMB_MONI even though the sender has sent the messade.
    Why RFC adapter is behaving like this? What could be the issue?
    Kindly help!

    EOIO: How does this queueing work? Does it use FIFO logic?
    >> yes it uses FIFO logic in EOIO.
    Also what is the significance of 'Initial connection' and 'maximum connections' in communication channel? I have given the default value 1 for both. What should be the ideal value and why?
    >>>noof rfc connections we are using for connecting to XI to RFC minmum is 1 maximum is 50 bydefault. you increase this value by changing the default setting.
    How does RFC adapter with EO/EOIO work? Kindly help!
    Posted: Mar 21, 2007 4:15 AM 
    Hi Experts,
    How does a sender or receiver RFC adapter works when QOS is EO or EOIO (Async)? In other words, for EOIO, are the messages are queued? How does this queueing work? Does it use FIFO logic? where do we specify the max limit of messages that can be queued?
    Also what is the significance of 'Initial connection' and 'maximum connections' in communication channel? I have given the default value 1 for both. What should be the ideal value and why?
    Why RFC adapter is behaving like this? What could be the issue?
    >>check ur sender RFC adapter. chekc whether data is sent from RFC . see logs in R/3.

  • I run Recovery 10.8.2 on my MBP does it delete any of mIfy files I have installed on it? Such as my folders with my school work.

    If I run Recovery 10.8.2 on my MBP does it delete any of my files I have installed on it? Such as my folders with my school work.

    If you reformat (erase) the drive, then yes, all your documents will be deleted.
    Restoring OS X does not erase your data but you should always backup your files regardless. Better safe than sorry.
    OS X Recovery
    Mac Basics: Time Machine backs up your Mac

  • How well does the iPhone 5s/5c work with Wind Mobile?

    I'm going to be (hopefully) getting the iphone 5s or 5c soon and I'm trying to decide on which carrier to go with. How well does the iphone 5s/5c work with wind mobile and how fast is the internet with data?

    http://www.windmobile.ca/
    iPhone: Wireless carrier support and features

  • Does the Apple A1096 adaptor work with the A1081 monitor? Can any one help? Thanks, Paul

    Does the Apple A1096 adaptor work with the A1081 monitor? Can any one help? Thanks, Paul

    Click on this link for the fix http://appletoolbox.com/2012/01/server-does-not-allow-relaying-email-error-fix/

  • I live in the country and there is no High speed available, How does Firefox for desk top work with Dial up ???

    I live in the country and there is no High speed available, How does Firefox for desk top work with Dial up ??? I have a great dell computer, Dimention 8400. Before I install firefox I want to know for no waste of time for either party..

    Unless you enabled Find My iPad on it before it was stolen then there isn't any way to locate it. If you did enable it then you could try locating it either via http://icloud.com on a computer or Find My iPhone on another device - but that will only work if it's connected to a network and the device hasn't already been wiped and/or Find My iPad disabled on it.
    If it was stolen then you should report it to the police. You should also change your iTunes account password, your email account passwords, and any passwords that you'd stored on websites/emails/notes etc.
    If it was never registered to your account then it won't appear on your support profile : https://supportprofile.apple.com/
    The only other ways to find it that I know of (apart from on the actual device) are via the packaging, the backup on a computer's iTunes : http://support.apple.com/kb/HT4061

Maybe you are looking for

  • DAQ card works with NIDAQ test panel but not with VB app/Component works

    I am seeing this problem with 2 different DAQ cards. The card works fine with the NIDAQ test panel, but acts like the return lead is lifted with my VB app. The plotted signal appears to be little more than noise. Channel scan is internally triggered;

  • Export Quanityfields with Open Hub

    Hi, i want to export an field (with type Quanity with fixed unit kg) with an Open Hub into a csv-file. All other fields (type currency and characteristics) are written into the csv-file. Only the quantity fields are blank. Do I have to use any conver

  • Java Files inside the jar file cannot be read or accessed through Eclpse

    The Java File inside the jar file of the eclipse cannot be accessed through the Eclipse . It shows error for the modules in the jar file . But when compiled with adding the jar files to the class path the compilation is successful . How can i browse

  • Black screen after interpret footage

    I am exporting 16x9 anamorphic SD video from Avid.   In Encore I import the quitktime reference, then choose "interpret footage" and set it to SD Widescreen.  Then when I transcode the video, all I get is black. If I transcode the video without using

  • Reusability of web dynpro callable object

    Hi, I want to use same webdynpro callable object inside another callable object including some extra input and output parameter. So that I dont have to write the same code again in another callable object. is it possible?