Search Results

Search found 29841 results on 1194 pages for 'random number generator'.

Page 31/1194 | < Previous Page | 27 28 29 30 31 32 33 34 35 36 37 38  | Next Page >

  • Lua: Random: Percentage

    - by jargl
    I'm creating a game and currently have to deal with some math.randomness. As I'm not that strong in Lua, how do you think Can you make an algorithm that uses math.random with a given percentage? I mean a function like this: function randomChance( chance ) -- Magic happens here -- Return either 0 or 1 based on the results of math.random end randomChance( 50 ) -- Like a 50-50 chance of "winning", should result in something like math.random( 1, 2 ) == 1 (?) randomChance(20) -- 20% chance to result in a 1 randomChance(0) -- Result always is 0 However I have no clue how to go on, and I completely suck at algorithms I hope you understood my bad explanation of what I'm trying to accomplish

    Read the article

  • Query to get row from one table, else random row from another

    - by Jimmy
    tblUserProfile - I have a table which holds all the Profile Info (too many fields) tblMonthlyProfiles - Another table which has just the ProfileID in it (the idea is that this table holds 2 profileids which sometimes become monthly profiles (on selection)) Now when I need to show monthly profiles, I simply do a select from this tblMonthlyProfiles and Join with tblUserProfile to get all valid info. If there are no rows in tblMonthlyProfile, then monthly profile section is not displayed. Now the requirement is to ALWAYS show Monthly Profiles. If there are no rows in monthlyProfiles, it should pick up 2 random profiles from tblUserProfile. If there is only one row in monthlyProfiles, it should pick up only one random row from tblUserProfile. What is the best way to do all this in one single query ? I thought something like this select top 2 * from tblUserProfile P LEFT OUTER JOIN tblMonthlyProfiles M on M.profileid = P.profileid ORder by NEWID() But this always gives me 2 random rows from tblProfile. How can I solve this ?

    Read the article

  • Select unseen random row from MySQL table

    - by user1476925
    We have a list of questions in a MySQL database and want it to show a random approved question to the user. When you click the Random button, we want another random question to be shown, but not any of the ones the user has already seen. Right now the script looks like this: <?php mysql_connect("localhost", "username", "password") or die(mysql_error()); mysql_select_db("aldrig") or die(mysql_error()); $result = mysql_query("SELECT * FROM spg WHERE approved='1' ORDER BY RAND() LIMIT 1;") or die(mysql_error()); while($row = mysql_fetch_array( $result )) { echo "<div class='contentTitle'><h1>"; echo $row['text']; echo "</h1></div>"; } ?>

    Read the article

  • Filling array with numbers from given range so that sum of adjacent numbers is square number

    - by REACHUS
    Problem: Fill all the cells using distinct numbers from <1,25 set, so that sum of two adjacent cells is a square number. (source: http://grymat.im.pwr.wroc.pl/etap1/zad1etp1213.pdf; numbers 20 and 13 have been given) I've already solved this problem analytically and now I would like to approach it using an algorithm. I would like to know how should I approach these kind of problems in general (not a solution, just a point for me to start).

    Read the article

  • Number of processes named 'doodle'

    - by Indian
    I have ben using 12.10 for a few days. Just upgraded it from 12.04. This comp of mine, which has a 4GB RAM and 64 bit intel processor, just goes slow randomly. When I press Ctrl+Alt+F6 and login through a command prompt, I see a number of processes using - ps -A I get many instances of a process named 'doodle' running. So many that I have to 'pkill' them by hand. Any idea why this is happening?

    Read the article

  • Reasonable Number of Directed Graph Nodes and Edges

    - by opensourcechris
    How many directed graph nodes are typically represented in the browser? I'm working with some large data-sets with nodes and edges more then 400,000. I'm wondering if I am going down a fruitless path trying to represent them in the browser via arbor.js or similar JS libraries. What's the most effective way to allow a large number of users to visualize and browse a large directed graph of up to 500,000 records?

    Read the article

  • Earn Your Number One Ranking With the Help of an Article Marketing Service

    One of the most popular methods of business promotion is using articles to drive more traffic to your website. Submitting articles for online publication can help you rank higher with the search engines and, if done well, it can take your business to the number one rank. If this is your goal, you may want to consider hiring an article marketing service to help you.

    Read the article

  • A new number one

    - by nospam(at)example.com (Joerg Moellenkamp)
    The Top500 supercomputer list has a new number one: The K Computer, built by Fujitsu, currently combines 68544 SPARC64 VIIIfx CPUs, each with eight cores, for a total of 548,352 cores?almost twice as many as any other system in the TOP500. The K Computer is also more powerful than the next five systems on the list combined.Interestingly this system runs under Linux. And it uses tofu as its interconnect

    Read the article

  • C is number one!

    <b>Cyber Cynic:</b> "What I didn't know was that, old as it is, C has actually maintained more of its popularity than I had thought and that it's now once more the number-one programming language in the world."

    Read the article

  • How to configure a longer version Number in artifactory

    - by claudine
    The version-numbers for our jars have to be longer them x.x.x. We would rather need x.x.x.x to integrate some old-fashioned self-made mechanism. This is, because we tag our software with x.x.x and as soon as we have a delivery to a customer one specific jar has to be build exactly at this point of time to fit to another backend, which communicates with our program. For that reason this one jar has the version 2.3.4.1, when generated and in next delivery of the same Version it is build and named 2.3.4.2. Now artifactory cannot handle this an doesn't save more than x.x.x.2 in some cases. So we thought of maybe edit the regular expression in the maven repository layout (see attached Screenshot) Because testing the path in the field below shows, that it cannot handle the version number. Of course for the rest of our jars still x.x.x has to work.. For Example here is the maven-metadata.xml <?xml version="1.0" encoding="UTF-8"?> <metadata> <groupId>com.firm</groupId> <artifactId>someid</artifactId> <version>1.5.1</version> <versioning> <latest>1.5.1</latest> <release>1.5.1</release> <versions> <version>1.4.62</version> </versions> <lastUpdated>20120926073942</lastUpdated> </versioning> </metadata> The folder structure looks like: someid 1.4.62 1.4.62.1 1.4.62.2 1.4.62.3 If we deploy an new artifact version (1.4.62.1), the maven-metadata.xml contains the 1.4.62.1 version. But the artifactory overrides the version number (1.4.62.x) to (1.4.62) after an unspecified time. It seems that the artifactory only support major, minor and revision numbers, and deletes the buildnumber. Now we looking for a solution do disable this behavior. We use the JFrog Artifactory version 2.5.0 (rev. 13086). Any ideas, maybe? Thanks in andvance

    Read the article

  • Texture and Pattern Generator

    - by Ara
    I use Adobe Fireworks for its Texture and Pattern tools to make things like this: http://i.imgur.com/sci7Roc.png and then i copy-paste it to Flash Professional (Adobe) to use there. but fireworks is so slow and buggy is there a free or commercial software to do this simple Texture / Pattern thing easily? Texture (like the second image above) Patter and Texture (like the first one) Transparent Texture, so the background color would be visible instead of the white lines in second image The ability to copy and paste it (as PNG 32 or any alpha transparent image) so i don't have to save it first and then import it to flash * I Use Mac OS X 10.8.4 *

    Read the article

  • Simple Prime Generator in Python

    - by marc lincoln
    Hi, could someone please tell me what I'm doing wrong with this code. It is just printing 'count' anyway. I just want a very simple prime generator (nothing fancy). Thanks a lot. lincoln. import math def main(): count = 3 one = 1 while one == 1: for x in range(2, int(math.sqrt(count) + 1)): if count % x == 0: continue if count % x != 0: print count count += 1

    Read the article

  • Parser generator for JavaME

    - by Anders K.
    First: I have looked at this SO question but unfortunately there is no mention of JavaME I am looking for a parser/lexer generator that produces code that can run on the Blackberry and its (obnoxious) JavaME. E.g. at first I thought I could use ANTLR however it seems the run-time library is not compatible with JavaME TIA

    Read the article

  • compact Number formatting behavior in Java (automatically switch between decimal and scientific notation)

    - by kostmo
    I am looking for a way to format a floating point number dynamically in either standard decimal format or scientific notation, depending on the value of the number. For moderate magnitudes, the number should be formatted as a decimal with trailing zeros suppressed. If the floating point number is equal to an integral value, the decimal point should also be suppressed. For extreme magnitudes (very small or very large), the number should be expressed in scientific notation. Alternately stated, if the number of characters in the expression as standard decimal notation exceeds a certain threshold, switch to scientific notation. I should have control over the maximum number of digits of precision, but I don't want trailing zeros appended to express the minimum precision; all trailing zeros should be suppressed. Basically, it should optimize for compactness and readability. 2.80000 - 2.8 765.000000 - 765 0.0073943162953 - 0.00739432 (limit digits of precision—to 6 in this case) 0.0000073943162953 - 7.39432E-6 (switch to scientific notation if the magnitude is small enough—less than 1E-5 in this case) 7394316295300000 - 7.39432E+6 (switch to scientific notation if the magnitude is large enough—for example, when greater than 1E+10) 0.0000073900000000 - 7.39E-6 (strip trailing zeros from significand in scientific notation) 0.000007299998344 - 7.3E-6 (rounding from the 6-digit precision limit causes this number to have trailing zeros which are stripped) Here's what I've found so far: The .toString() method of the Number class does most of what I want, except it doesn't upconvert to integer representation when possible, and it will not express large integral magnitudes in scientific notation. Also, I'm not sure how to adjust the precision. The "%G" format string to the String.format(...) function allows me to express numbers in scientific notation with adjustable precision, but does not strip trailing zeros. I'm wondering if there's already some library function out there that meets these criteria. I guess the only stumbling block for writing this myself is having to strip the trailing zeros from the significand in scientific notation produced by %G.

    Read the article

  • Online Screenshot Generator for Mac

    - by BillB
    I'm looking for a free online web page screenshot generator that will take photos of Mac browsers. I've looked at: BrowsrCamps BrowserShots LitmusApp All of which I'm sure are good but charge for a screenshot of your web app using a Mac browser. Does anyone know of a free alternative.

    Read the article

  • Agilent E4426B signal generator locks up during multiple GPIB *SAV operations

    - by aspiehler
    I have a test fixture with an Agilent E4426B RF signal generator connected to a PC via a National Instrument Ethernet-to-GPIB bridge. My software is attempting to sanitize the instrument by presetting it and then saving the current state to all of the memory locations writable via the standard SCPI command "*SAV x,y". The loop works to a point, but eventually the instrument responds with an error and continuously displays the "L" icon on the front display and a "Remote preset" message at the bottom. At that point it won't respond to any more remote commands and I have to either cycle power or press LOCAL, then PRESET at which point it takes about 3 minutes to finish presetting. At that point the "L" icon is still present and and the next GPIB command sent to the instrument causes it to report a -113 error (undefined header) in the instrument error queue. I fired up NI spy to see what was happening, and found that the error was happening at the same point in the loop - "*SAV 6,2" in this case. From NI Spy: Send (0, 0x0017, "*SAV 6,2", 8 (0x8), NLend (0,0x01)) Process ID: 0x00000520 Thread ID: 0x00000518 ibsta:0xc168 iberr: 6 ibcntl: 2(0x2) And here's the code from the instrument driver: int CHP_E4426b::Erase() { if ((m_StatusCode = Initialize()) != GPIB_SUCCESS) // basically just sends "*RST" return m_StatusCode; m_SaveState = "*SAV %d, %d"; for (int i=0; i < 10; i++) for (int j=0; j < 100; j++) { sprintf(m_CmdString, m_SaveState, j, i); if ((m_StatusCode = Send(m_CmdString, strlen(m_CmdString))) != GPIB_SUCCESS) return m_StatusCode; } return GPIB_SUCCESS; } I tried putting a small Sleep() delay (10-20 ms) at the end of the inner loop, and to my surprise it caused the error to show up earlier rather than later. 10 ms caused the loop to error out at 44,1 and 20 ms was even sooner. I've already eliminated faulty cabling or the instrument as the culprit. This same type of sequence works without any error on a higher end signal generator, so I'm tempted to chalk this up to a bug in the instrument's firmware.

    Read the article

  • iphone barcode generator

    - by hardik
    hello all i want to develop one bar code generator application in my native iphone i currently don't know what is bar code and how to generate it please guide me how do i proceed towards it

    Read the article

  • Random Color generator in Javascript

    - by n00ki3
    Hi there, i am not an Javascript and i need a little help. Given this function , i want to replace the color with an Random Color generator. document.overlay = GPolyline.fromEncoded({color: "#0000FF", weight: 10, points: encoded_points, zoomFactor: 32, levels: encoded_levels, numLevels: 4 }); Can anyone help me ?

    Read the article

  • A good free BON diagram generator?

    - by Audel
    Hello I need to create a static BON diagram which represents a set of clusters, classes and their relationships(inheritance and client-supplier). Does anyone know a good diagram generator I can get for free? The BON diagram is similar to the C sharp's class diagram but this one is generated by Eiffel studio =/ any diagram generators recommendations are welcome ;D Thanks in advance .

    Read the article

  • random quote generator in php using mysql

    - by fusion
    i coded a random quote generator in php using mysql but also jquery. however when i try to integrate it with facebook, since i opted to use fbml, i could not use jquery. how do i get the quote to display randomly in php at say, 30 mins, without using jquery or javascript?

    Read the article

< Previous Page | 27 28 29 30 31 32 33 34 35 36 37 38  | Next Page >