Search Results

Search found 6504 results on 261 pages for 'random joe'.

Page 12/261 | < Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >

  • Possible applications of algorithm devised for differentiating between structured vs random text

    - by rooznom
    I have written a program that can rapidly (within 5 sec on a 2GB RAM desktop, 2.33 Ghz CPU) differentiate between structured text (e.g english text) and random alphanumeric strings. It can also provide a probability score for the prediction. Are there any practical applications/uses of such a program. Note that the program is based on entropy models and does not have any dictionary comparisons in its workflow. Thanks in advance for your responses

    Read the article

  • How does this C# asp.net random password code work?

    - by quakkels
    Hello all, I'm new to .NET and C# and I'm trying to figure out how this code works: public static string CreateRandomPassword(int PasswordLength) { String _allowedChars = "abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNOPQRSTUVWXYZ23456789"; Byte[] randomBytes = new Byte[PasswordLength]; RNGCryptoServiceProvider rng = new RNGCryptoServiceProvider(); rng.GetBytes(randomBytes); char[] chars = new char[PasswordLength]; int allowedCharCount = _allowedChars.Length; for(int i = 0;i<PasswordLength;i++) { /// /// I don't understand how this line works: /// chars[i] = _allowedChars[(int)randomBytes[i] % allowedCharCount]; } return new string(chars); } I think I've got a pretty good handle on most of this. I haven't been able to understand the following line: chars[i] = _allowedChars[(int)randomBytes[i] % allowedCharCount]; I understand that the code generates random binary numbers and uses those random numbers in the for loop to select a character from the _allowedChars string. What I don't get is why this code uses the modulous operator (%) to get the _allowedChars index value. Thanks for any help

    Read the article

  • How to generate a good random seed to pass to srand()?

    - by zr
    Hi, I am writing a C++ program which needs to create a temporary file for its internal usage. I would like to allow concurrent executions of the program by running multiple proccesses, so the temporary file name needs to be randomized, that way each spawned process will generate a unique temporary file name for its own use. I am using rand() to generate random characters for part of the file name, so i need to initialize the random number generator's seed using srand(). What options are there for passing a good argument to srand() such that two processes will not be initialized with the same seed value? My code needs to work both on Windows and pn Linux TIA.

    Read the article

  • Oracle aggregate function to return a random value for a group?

    - by tpdi
    The standard SQL aggregate function max() will return the highest value in a group; min() will return the lowest. Is there an aggregate function in Oracle to return a random value from a group? Or some technique to achieve this? E.g., given the table foo: group_id value 1 1 1 5 1 9 2 2 2 4 2 8 The SQL query select group_id, max(value), min(value), some_aggregate_random_func(value) from foo group by group_id; might produce: group_id max(value), min(value), some_aggregate_random_func(value) 1 9 1 1 2 8 2 4 with, obviously, the last column being any random value in that group.

    Read the article

  • How hard is it to create a not-so-random number generator?

    - by Duracell
    Backstory: So I was driving to band practice this evening. My car has a USB port where you can plug in a USB stick with MP3 files on it and the stereo will play them. I have about 100 MP3s on my stick so I pushed the 'Random' button. So from here to band practice, it played: Track 22 Track 45 Track 4 Track 11 Track 87 Track 66 Track 98 Then on the way home, it played Track 16 Track 27 Track 33 And then I stopped at the petrol station. I filled up, got back in the car and the stereo fired up again. It played Track 22 Track 45 Track 4 Track 11 Track 87 I thought, WTF? What's with this 'random' generator? What are they using as a seed, if not time? Is a car stereo so memory-tight that it can't even use the C stdlib? Does anyone know how this kind of thing happens?

    Read the article

  • What's the best way to return a random line in a text file using C?

    - by jeremy Ruten
    What's the best way to return a random line in a text file using C? It has to use the standard I/O library (<stdio.h>) because it's for Nintendo DS homebrew. Clarifications: Using a header in the file to store the number of lines won't work for what I want to do. I want it to be as random as possible (the best being if each line has an equal probability of being chosen as every other line.) The file will never change while the program is being run. (It's the DS, so no multi-tasking.)

    Read the article

  • How to make a random number generator in matlab that is based on percentages?

    - by Ben Fossen
    I am currently using the built in random number generator. for example nAsp = randi([512, 768],[1,1]); 512 is the lower bound and 768 is the upper bound, the random number generator chooses a number from between these two values. What I want is to have two ranges for nAsp but I want one of them to get called 25% of the time and the other 75% of the time. Then gets plugged into he equation. Does anyone have any ideas how to do this or if there is a built in function in matlab already? for example nAsp = randi([512, 768],[1,1]); gets called 25% of the time nAsp = randi([690, 720],[1,1]); gets called 75% of the time

    Read the article

  • Random select is not always returning a single row.

    - by Lieven
    The intention of following (simplified) code fragment is to return one random row. Unfortunatly, when we run this fragment in the query analyzer, it returns between zero and three results. As our input table consists of exactly 5 rows with unique ID's and as we perform a select on this table where ID equals a random number, we are stumped that there would ever be more than one row returned. Note: among other things, we already tried casting the checksum result to an integer with no avail. DECLARE @Table TABLE ( ID INTEGER IDENTITY (1, 1) , FK1 INTEGER ) INSERT INTO @Table SELECT 1 UNION ALL SELECT 2 UNION ALL SELECT 3 UNION ALL SELECT 4 UNION ALL SELECT 5 SELECT * FROM @Table WHERE ID = ABS(CHECKSUM(NEWID())) % 5 + 1

    Read the article

  • How to generate random strings that match a given regexp?

    - by Pies
    Duplicate: Random string that matches a regexp No, it isn't. I'm looking for an easy and universal method, one that I could actually implement. That's far more difficult than randomly generating passwords. I want to create an application that takes a regular expression, and shows 10 randomly generated strings that match that expression. It's supposed to help people better understand their regexps, and to decide i.e. if they're secure enough for validation purposes. Does anyone know of an easy way to do that? One obvious solution would be to write (or steal) a regexp parser, but that seems really over my head. I repeat, I'm looking for an easy and universal way to do that. Edit: Brute force approach is out of the question. Assuming the random strings would just be [a-z0-9]{10} and 1 million iterations per second, it would take 65 years to iterate trough the space of all 10-char strings.

    Read the article

  • Repeated calls with random Javascript append to the URL

    - by cjk
    I keep getting calls to my server where there is random Javascript appended on the end of lots of the calls, e.g.: /UI/Includes/JavaScript/).length)&&e.error( /UI/Includes/JavaScript/,C,!1),a.addEventListener( /UI/Includes/JavaScript/),l=b.createDocumentFragment(),m=b.documentElement,n=m.firstChild,o=b.createElement( /UI/Includes/JavaScript/&&a.getAttributeNode( /UI/Includes/JavaScript/&&a.firstChild.getAttribute( /UI/Includes/JavaScript/).replace(bd, /UI/Includes/JavaScript/)),a.getElementsByTagName( The user agent is always this: Mozilla/4.0+(compatible;+MSIE+6.0;+Windows+NT+5.1;+SV1;+.NET+CLR+2.0.50727) I have jQuery, Modernizr and other JS and originally thought that some browser was messing up it's JS calls, however this particular IP address hasn't requested any images so I'm wondering if it is some kind of attack. Is this a common occurence?

    Read the article

  • 12.04 Random sounds sometimes after startup

    - by Timothy Duane
    I'm not quite sure what the sound is, but it has only started happening in the last two days. The only way I can describe it would be that it sounds like a wooden xylophone being tapped lightly. It will play at random intervals ranging between 1 second to a couple minutes for up to a half hour (from what I have noticed) after startup. If anybody has any ideas as to what is causing this or how to fix it I would appreciate it. System information: Computer: Toshiba Satellite L655-S5160 Audio Driver: Conexant Audio Driver(v4.119.0.60; 07-14-2010; 41.89M)

    Read the article

  • Execure a random command from .txt file?

    - by Alberto Burgos
    I have a Ubuntu server, and I'm trying to print a Twitter quote using the app "twidge". So I made a list of tweets on a .txt file. I want to print one tweet (per line) from that file and send it to Twitter via twidge (or what ever other method was possible). I can print a random phrase with shuf: shuf -n 1 /var/www/tweets.txt and it works. It sends me back one of the tweets, but, it does not send it to Twitter, even if the "in line" phrase is a command. i.e: twidge update "bla bla bla" It just prints on the screen, but don't send it to Twitter. I tried turning the .txt to .sh, but don't work... any idea? by the way, i want to use it with crontab, something like this: 15 * * * * shuf -n 1 /var/www/tweets.txt

    Read the article

  • Random freezes on MBP9,2 + Ubuntu 12.04

    - by EnToutCas
    I have a MBP9,2 (mid-2012) at work. I put Ubuntu 12.04 on it after some efforts. Everything works more or less now, except I get random freezing every now and then. I have to power off the machine to restore it. Wondering if anyone had the similar issue. My setup: MacBook Pro 9,2 (mid 2012) Ubuntu 12.04 (installed using the special image for Macs) No proprietary drivers xmonad on Unity 2D So far the freezes look to be sporadic and spontaneous.

    Read the article

  • Random/Procedural vs. Previously Made Level Generation

    - by PythonInProgress
    I am making a game (called "Glory") that is a top-down explorer game, and am wondering what the advantages/disadvantages of using random/procedural generation vs. pre-made levels are. There seems to be few that i can think of, other than the fact that items may be a problem to distribute in randomly generated terrain, and that the generated terrain may look weird. The downside to previously made levels is that I would need to make a level editor, though. I cannot decide what is better to use.

    Read the article

  • Algorithm to generate N random numbers between A and B which sum up to X

    - by Shaamaan
    This problem seemed like something which should be solvable with but a few lines of code. Unfortunately, once I actually started to write the thing, I've realized it's not as simple as it sounds. What I need is a set of X random numbers, each of which is between A and B and they all add up to X. The exact variables for the problem I'm facing seem to be even simpler: I need 5 numbers, between -1 and 1 (note: these are decimal numbers), which add up to 1. My initial "few lines of code, should be easy" approach was to randomize 4 numbers between -1 and 1 (which is simple enough), and then make the last one 1-(sum of previous numbers). This quickly proved wrong, as the last number could just as well be larger than 1 or smaller than -1. What would be the best way to approach this problem? PS. Just for reference: I'm using C#, but I don't think it matters. I'm actually having trouble creating a good enough solution for the problem in my head.

    Read the article

  • Calculate random points (pixel) within a circle (image)

    - by DMills
    I have an image that contains a circles at a specific location, and of a specific diameter. What I need to do is to be able to calculate random points within the circle, and then manipulate said the pixels they correlate to. I have the following code already: private Point CalculatePoint() { var angle = _random.NextDouble() * ( Math.PI * 2 ); var x = _originX + ( _radius * Math.Cos( angle ) ); var y = _originY + ( _radius * Math.Sin( angle ) ); return new Point( ( int )x, ( int )y ); } And that works fine for finding all the points at the circumference of the circle, but I need all points from anywhere in the circle. If this doesn't make sense let me know and I will do my best to clarify.

    Read the article

  • Update on: How to model random non-overlapping spheres of non-uniform size in a cube using Matlab?

    - by user3838079
    I am trying to use MATLAB for generating random locations for non-uniform size spheres (non-overlapping) in a cube. The for loop in the code below never seems to end. I don't know what am missing in the code. I have ran the code for no. of spheres (n) = 10; dims = [ 10 10 10 ] function [ c r ] = randomSphere( dims ) % creating one sphere at random inside [0..dims(1)]x[0..dims(2)]x... % radius and center coordinates are sampled from a uniform distribution % over the relevant domain. % output: c - center of sphere (vector cx, cy,... ) % r - radius of sphere (scalar) r = rand(1); % you might want to scale this w.r.t dims or other consideration c = r + rand( size(dims) )./( dims - 2*r ); % make sure sphere does not exceed boundaries function ovlp = nonOverlapping( centers, rads ) % check if several spheres with centers and rads overlap or not ovlp = false; if numel( rads ) == 1 return; % nothing to check for a single sphere end dst = sqrt( sum( bsxfun( @minus, permute( centers, [1 3 2] ),... permute( centers, [3 1 2] ) ).^2, 3) ); ovlp = dst >= bsxfun( @plus, rads, rads.' ); %' all distances must be smaller than r1+r2 ovlp = any( ovlp(:) ); % all must not overlap function [centers rads] = sampleSpheres( dims, n ) % dims is assumed to be a row vector of size 1-by-ndim % preallocate ndim = numel(dims); centers = zeros( n, ndim ); rads = zeros( n, 1 ); ii = 1; while ii <= n [centers(ii,:), rads(ii) ] = randomSphere( dims ); if nonOverlapping( centers(1:ii,:), rads(1:ii) ) ii = ii + 1; % accept and move on end end

    Read the article

  • What are best practices for testing programs with stochastic behavior?

    - by John Doucette
    Doing R&D work, I often find myself writing programs that have some large degree of randomness in their behavior. For example, when I work in Genetic Programming, I often write programs that generate and execute arbitrary random source code. A problem with testing such code is that bugs are often intermittent and can be very hard to reproduce. This goes beyond just setting a random seed to the same value and starting execution over. For instance, code might read a message from the kernal ring buffer, and then make conditional jumps on the message contents. Naturally, the ring buffer's state will have changed when one later attempts to reproduce the issue. Even though this behavior is a feature it can trigger other code in unexpected ways, and thus often reveals bugs that unit tests (or human testers) don't find. Are there established best practices for testing systems of this sort? If so, some references would be very helpful. If not, any other suggestions are welcome!

    Read the article

  • What is the difference between _Procedural Generation_ and _Random Generation_?

    - by U-No-Poo
    Today, I got into an argument about the term "procedural generation". My point was that its different from "classic" random generation in that procedural generation is based on a more mathematical, fractal-based, algorithm leading to a more "realistic" distribution and the usual randomness of most languages are based on a pseudo-random-number generator, leading to an "unrealistic", in a way, ugly, distribution. This discussion was made with a heightmap in mind. The discussion left me somehow unconvinced about my own arguments though, so, is there more to it? Or am I the one who is, in fact, simply wrong?

    Read the article

  • How can I ensure reasonably spaced out enemies

    - by Samuraisoulification
    I have a simple javascript game and I'm initializing their positions on the y axis using random numbers. How can I ensure that they are reasonably spaced apart? My simple algorithm is: y = (Math.random()*1000%600); However I frequently get enemies almost directly on top of each other. This is a huge problem for the game, since it's a word game and the enemies have text on their center, that if overlapped makes them impossible to kill since you can't see the words. Any advice would be appreciated! I'm pretty new to making games in general so this has all been a learning experience for me!

    Read the article

  • Websockets through Stunnel is giving random bytes.

    - by user16682
    I have several servers set up for a web application that I am developing. One is a load balancing server, and I'm running a php WebSockets server on this balancer. The website that I am developing on uses ssl, so I have my WebSockets running through a wss uri connecting directly to the balancer, where I have set up stunnel4 to decrypt all traffic at a certain port and re-rout it to my php WebSockets server. This works fine when it comes down to connecting to my server. That's not the problem. The problem occurs when I try to send data to the server. Occasionally when I try this, stunnel does not appear to be decrypting the data properly. I get garbage characters in my termanal running the server: what appear to be completely random bytes. This can sometimes go on for several consecutive messages that I send before abruptly working again. It is very erratic and unpredictable. Sometimes I refresh the page, and all the messages work perfectly. Sometimes the WebSocket connects and I have to wait 5-10 seconds before any messages I send are interpreted properly by the server. Other times I can't send any messages at all, because they all end up as garbage. I believe this is a stunnel problem, but I am not certain. Does anybody have any experience with this? I would like a more predictable server if I can get it. Some more information: This occurs extensively in Chrome, not quite as much in FireFox, and never in Safari. The php server I am using is phpws http://code.google.com/p/phpws/ -- On the WebSocket connection, this server would sometimes detect that the header was only 1 byte in size, the first byte of the WebSockets header. I had to modify the server to flush the buffer ever time this occurred so that it would reliably connect.

    Read the article

  • Join the Geek+ Community on Google+ and Share Your Random Geekery

    - by The Geek
    It turns out that Google+ recently added a new feature that allows you to create your own community inside of Google+, where anybody that’s a member can post images, links, or start a discussion. We’ve created the Geek+ Community, so stop by and join in the fun. You’ll notice that there’s only a few members right now, but we’re hoping that we can get every How-To Geek reader to participate in the geeky discussion. You’re welcome to: Post random geeky stuff that you find. Yell at us for articles that you don’t like, or tell us how we can do things better. Participate in discussions with other HTG readers. Post up your own Geek Trivia. We might even publish it over here on How-To Geek. Ask others for advice. Just read everything that the other readers post. Lots of other things we can’t think of right now. Note: If you want tech support, you should post on our regular forum. Secure Yourself by Using Two-Step Verification on These 16 Web Services How to Fix a Stuck Pixel on an LCD Monitor How to Factory Reset Your Android Phone or Tablet When It Won’t Boot

    Read the article

  • Calculating 3d rotation around random axis

    - by mitim
    This is actually a solved problem, but I want to understand why my original method didn't work (hoping someone with more knowledge can explain). (Keep in mind, I've not very experienced in 3d programming, having only played with the very basic for a little bit...nor do I have a lot of mathematical experience in this area). I wanted to animate a point rotating around another point at a random axis, say a 45 degrees along the y axis (think of an electron around a nucleus). I know how to rotate using the transform matrix along the X, Y and Z axis, but not an arbitrary (45 degree) axis. Eventually after some research I found a suggestion: Rotate the point by -45 degrees around the Z so that it is aligned. Then rotate by some increment along the Y axis, then rotate it back +45 degrees for every frame tick. While this certainly worked, I felt that it seemed to be more work then needed (too many method calls, math, etc) and would probably be pretty slow at runtime with many points to deal with. I thought maybe it was possible to combine all the rotation matrixes involve into 1 rotation matrix and use that as a single operation. Something like: [ cos(-45) -sin(-45) 0] [ sin(-45) cos(-45) 0] rotate by -45 along Z [ 0 0 1] multiply by [ cos(2) 0 -sin(2)] [ 0 1 0 ] rotate by 2 degrees (my increment) along Y [ sin(2) 0 cos(2)] then multiply that result by (in that order) [ cos(45) -sin(45) 0] [ sin(45) cos(45) 0] rotate by 45 along Z [ 0 0 1] I get 1 mess of a matrix of numbers (since I was working with unknowns and 2 angles), but I felt like it should work. It did not and I found a solution on wiki using a different matirx, but that is something else. I'm not sure if maybe I made an error in multiplying, but my question is: this is actually a viable way to solve the problem, to take all the separate transformations, combine them via multiplying, then use that or not?

    Read the article

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