Search Results

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

Page 10/1194 | < Previous Page | 6 7 8 9 10 11 12 13 14 15 16 17  | Next Page >

  • SQL query, select from 2 tables random

    - by klaus
    Hello all i have a problem that i just CANT get to work like i what it.. i want to show news and reviews (2 tables) and i want to have random output and not the same output here is my query i really hope some one can explain me what i do wrong SELECT anmeldelser.billed_sti , anmeldelser.overskrift , anmeldelser.indhold , anmeldelser.id , anmeldelser.godkendt FROM anmeldelser LIMIT 0,6 UNION ALL SELECT nyheder.id , nyheder.billed_sti , nyheder.overskrift , nyheder.indhold , nyheder.godkendt FROM nyheder ORDER BY rand() LIMIT 0,6

    Read the article

  • Get random enum from a select group

    - by Coward
    Given a group of about 20 enums that I cannot modify. Im looking for an elegant solution to generate a random enum from a specific sample (ie, 2, 7, 18) I could put these into an arraylist, but thought I would ask if there is something else I could try.

    Read the article

  • Haskell and random numbers

    - by John D.
    Hi, I've been messing with Haskell few days and stumbled into a problem. I need a method that returns a random list of integers ( Rand [[Int]] ). So, I defined a type: type Rand a = StdGen -> (a, StdGen). I was able to produce Rand IO Integer and Rand [IO Integer] ( (returnR lst) :: StdGen -> ([IO Integer], StdGen) ) somehow. Any tips how to produce Rand [[Int]]?

    Read the article

  • SQL OUTER JOIN with NEWID to generate random data for each row

    - by CL4NCY
    Hi, I want to generate some test data so for each row in a table I want to insert 10 random rows in another, see below: INSERT INTO CarFeatures (carID, featureID) SELECT C.ID, F.ID FROM dbo.Cars AS C OUTER APPLY ( SELECT TOP 10 ID FROM dbo.Features ORDER BY NEWID() ) AS F Only trouble is this returns the same values for each row. How do I order them randomly?

    Read the article

  • Select random line in SQL database

    - by Jensen
    Hi, I would like to select a random line in my database. I saw this solution on a website: SELECT column FROM table ORDER BY RAND() LIMIT 1 This SQL query run but someone said me that it was a non performant query. Is there another solution ? Thx

    Read the article

  • How to generate random html document

    - by karramba
    I'd like to generate completely random piece of html source, possibly from a grammar. I want to do this in python but I'm not sure how to proceed -- is there a library that takes a grammar and just randomly follows its rules, printing the path? Ideas?

    Read the article

  • Php random row help...

    - by Skillman
    I've created some code that will return a random row, (well, all the rows in a random order) But i'm assuming its VERY uneffiecent and is gonna be a problem in a big database... Anyone know of a better way? Here is my current code: $count3 = 1; $count4 = 1; //Civilian stuff... $query = ("SELECT * FROM `*Table Name*` ORDER BY `Id` ASC"); $result = mysql_query($query); while($row = mysql_fetch_array($result)) { $count = $count + 1; $civilianid = $row['Id']; $arrayofids[$count] = $civilianid; //echo $arrayofids[$count]; } while($alldone != true) { $randomnum = (rand()%$count) + 1; //echo $randomnum . "<br>"; //echo $arrayofids[$randomnum] . "<br>"; $currentuserid = $arrayofids[$randomnum]; $count3 += 1; while($count4 < $count3) { $count4 += 1; $currentarrayid = $listdone[$count4]; //echo "<b>" . $currentarrayid . ":" . $currentuserid . "</b> "; if ($currentarrayid == $currentuserid){ $found = true; //echo " '" .$found. "' "; } } if ($found == true) { //Reset array/variables... $count4 = 1; $found = false; } else { $listdone[$count3] = $currentuserid; //echo "<u>" . $count3 .";". $listdone[$count3] . "</u> "; $query = ("SELECT * FROM `*Tablesname*` WHERE Id = '$currentuserid'"); $result = mysql_query($query); $row = mysql_fetch_array($result); $username = $row['Username']; echo $username . "<br>"; $count4 = 1; $amountdone += 1; if ($amountdone == $count) { //$count $alldone = true; } } } Basically it will loop until its gets an id (randomly) that hasnt been chosen yet. -So the last username could take hours :P Is this 'bad' code? :P :(

    Read the article

  • Color generation based on random number

    - by Mikulas Dite
    I would like to create a color generator based on random numbers, which might differ just slightly, but I need colors to be easily recognizable from each other. I was thinking about generation then in a rgb format which would be probably easiest. I'm afraid simply multiplying given arguments wouldn't do very well. What algorithm do you suggest using? Also, second generated color should not be the same as previous one, but I don't want to store them - nor multiplying with (micro)time would do well since the scripts' parts are usually faster.

    Read the article

  • Random numbers from binomial distribution

    - by Sarah
    I need to generate quickly lots of random numbers from binomial distributions for dramatically different trial sizes (most, however, will be small). I was hoping not to have to code an algorithm by hand (see, e.g., this related discussion from November), because I'm a novice programmer and don't like reinventing wheels. It appears Boost does not supply a generator for binomially distributed variates, but TR1 and GSL do. Is there a good reason to choose one over the other, or is it better that I write something customized to my situation? I don't know if this makes sense, but I'll alternate between generating numbers from uniform distributions and binomial distributions throughout the program, and I'd like for them to share the same seed and to minimize overhead. I'd love some advice or examples for what I should be considering.

    Read the article

  • Relative probabilities using random number gen

    - by CyberShot
    If I have relative probabilities of events A, B, C occurring. i.e P(A) = 0.45, P(B) = 0.35, P(C) = 0.20, How do I do represent this using a random number generator between 0 and 1? i.e. R = rand(0,1) if (R < 0.45) event A else if(R < 0.35) event B else if(R < 0.20) event C The above works for two events A,B but I think the above is wrong for three or more since there is overlapping. This is obviously a very simple question and the answer should be immediately evident, but I'm just too stupid to see it.

    Read the article

  • ArrayList of Entites Random Movement

    - by opiop65
    I have an arraylist of entites that I want to move randomly. No matter what I do, they won't move. Here is my female class: import java.awt.Graphics2D; import java.awt.Image; import java.awt.Rectangle; import java.util.Random; import javax.swing.ImageIcon; public class Female extends Entity { static int femaleX = 0; static int femaleY = 0; double walkSpeed = .1f; Random rand = new Random(); int random; int dir; Player player; public Female(int posX, int posY) { super(posX, posY); } public void update() { posX += femaleX; posY += femaleY; } public void draw(Graphics2D g2d) { g2d.drawImage(getFemaleImg(), posX, posY, null); if (Player.showBounds == true) { g2d.draw(getBounds()); } } public Image getFemaleImg() { ImageIcon ic = new ImageIcon("res/female.png"); return ic.getImage(); } public Rectangle getBounds() { return new Rectangle(posX, posY, getFemaleImg().getHeight(null), getFemaleImg().getWidth(null)); } public void moveFemale() { random = rand.nextInt(3); System.out.println(random); if (random == 0) { dir = 0; posX -= (int) walkSpeed; } } } And here is how I update the female class in the main class: public void actionPerformed(ActionEvent ae) { player.update(); for(int i = 0; i < females.size(); i++){ Female tempFemale = females.get(i); tempFemale.update(); } repaint(); } If I do something like this(in the female update method): public void update() { posX += femaleX; posY += femaleY; posX -= walkSpeed; } The characters move with no problem. Why is this?

    Read the article

  • Quantis Quantum Random Number Generator (QRNG) - any reviews?

    - by Tim Post
    I am thinking about getting one of these (PCI) to set up an internal entropy pool similar to this service who incidentally brought us fun captcha challenges. Prior to lightening my wallet, I'm hoping to gather feedback from people who may be using this device. As there is no possible 'correct' answer, I am making this CW and tagging it as subjective. I'm undertaking a project to help write Monte Carlo simulations for a non profit that distributes mosquito nets in Malaria stricken areas. The idea is to model areas to determine the best place to distribute mosquito nets. During development, I expect to consume gigs if not more of the RNG output. We really need our own source. Is this device reliable? Does it have to be re-started often? Is its bandwidth really as advertised? It passes all tests, as far as randomness goes (i.e. NIST/DIEHARD). What I don't want is something in deadlock due to some ioctl in disk sleep that does nothing but radiate heat. This is not a spamvertisement, I'm helping out of pocket and I really, really want to know if such a large purchase will bear fruit. I can't afford to build a HRNG based on radioactive decay, this looks like the next best thing. Any comments are appreciated. I will earn zero rep for this, please do not vote to close. This is no different than questions regarding the utilization of some branded GPU for some odd purpose. Answers pointing to other solutions will be gladly accepted, I'm not married to this idea.

    Read the article

  • Simple ADO.NET C# Stored Procedure Generator

    - by Ron
    I am using Visual Studio 2005, Sql Server 2005, C#, ADO.NET. We have a very large database and routinely adding new stored procedures. I am tired of writing the C# wrapper code for these stored procedures, seems like there should be some simple utility or Add In that would allow me to simply point to a stored procedure and generate some generic C# code. I am not looking for some big ORM or data access layer framework. The company I am doing this for is not interested in moving to something like that right now. Just wanting something to take the grunt work out of writing the C# wrappers around stored procedures. Again, prefer that we do not have to include in other 3rd party libraries, etc. Any ideas?

    Read the article

  • Sitemap.xml generator

    - by miller55
    I need some sitemap generator that support unlimited pages. Also is there some generator that support that i remove some pages from crowing. For example i have some pages like reviews pages which are generate automatically when someone add review. They all look like: mysite.com/review_1.hml mysite.com/review_2.hml and so on ...... so i dont want to sitemap generate those pages. Thanks in advance!

    Read the article

  • Interpolation not working on Rails generator

    - by Tom
    For some reason the code I have included below does not interpolate the variables into the template. It simply copies the file over verbatim. I cannot figure out why. https://gist.github.com/60484f7b57b06b6eb3e3 The Rails version is 2.3.4. Thanks in advance!

    Read the article

  • C# Visual Studio UML Class Diagram Generator

    - by ikurtz
    I was wondering if there was a software that would generate UML class diagrams from my project files (C#) in Visual Studio 2008 Professional? Like a plugin of sorts? Thanks in advance. p.s. I have checked previous posts and did not see anything useful on the first glance. EDIT: I found Class Diagram item! but open to more tips.

    Read the article

  • JSF action, value and binding catalog generator

    - by BBSnowman
    I am looking for a simple tool that generates a catalog of all used action methods, values and bindings. I'm working on a big JSF/RichFaces project and I have lost the overview of the used links to the beans. Therefore I need a tool (would be nice if it is a Eclipse plugin) that generates a simple list of all used EL expressions. Is there something out there?

    Read the article

  • How can I create a content widget generator?

    - by Richard
    Sites like Buzzfeed offer widgets (Javascript, PHP, WordPress, etc.) for syndicating their content on other sites. Does anyone have any ideas on how I could go about creating/implementing some kind of interactive widget generator that gives users options for customizing their widget? I assume this would require RSS. Check out the Buzzfeed generator to see what I mean http://www.buzzfeed.com/network/widget

    Read the article

< Previous Page | 6 7 8 9 10 11 12 13 14 15 16 17  | Next Page >