Programming :: Srand (static_cast<unsigned Int>(clock( ))); Seems Not Random Enough

Jul 21, 2011

I copied and test a simple random number generate program

#include <algorithm>
#include <vector>
#include <iterator>
#include <iostream>

[code]....

View 2 Replies


ADVERTISEMENT

OpenSUSE :: Time / Clock Resets - Random On 11.3

Sep 3, 2010

I done searches for "clock" and found similar threads, but no real fix that is working for me. My clock resets when I boot into linux. It does not happen in windows or bios even on cold boots. The battery is replaced and good** the old battery was by all measures dead (0.6v), but still seemed to have enough power for the clock, since windows tested fine with it.

I have tryed setting it to local time, UTC.. etc... My timezone is GMT (london). "sudo /sbin/hwclock --systohc" Although I have windows, I do not use it except the few times to test this, so no conflict.

View 9 Replies View Related

Programming :: Unsigned Integers In C?

Mar 24, 2009

From what I understand, if I attempt to increment an unsigned int which is already at its max value, it will flip back to zero.Question: is this guaranteed to happen by the C language? That is, can I count on this happening on all platforms?(Of course, I recognize that the max value of the int will change from platform to platform...)

View 5 Replies View Related

Programming :: MySQL Unsigned Character?

Jan 8, 2010

I am trying to create a table T having a field F which should be able to store variable-length sequences of "unsigned" characters (8bit values ranging from 0 to 255 (not including 0, including 255)).(MAX_LENGTH) is not working, as it seems to want sequences of 8bit values ranging from 0 to 127 (thus "signed" characters).Can anyone help me by pointing out if there is a type suited for my needs (or if such a type does not exist)?For those familiar to C programming and working with the MySQL client library, I should be able to (successfully) do something along the lines of:

Code:
unsigned char value[] = { 'H', 'E', 'L', 'L', 'O', -1, -128, 'W', 'O', 'R', 'L', 'D' };
unsigned char query[255];

[code]....

View 3 Replies View Related

Programming :: Copying Unsigned Char To Uint64_t?

Oct 17, 2010

I am a dummy in C programming. I have a problem with copying the array of 64 elements of unsigned char to array of 8 element of uint64_t. For example:

unsigned char p[64]
uint64_t Data[8];
memcpy (&Data, &p, 64);

I am not sure if it is right. Please help me. Thanks a lot.Moreover, do both p and Data have 64 bytes?

View 2 Replies View Related

Programming :: ANSI C Code Seg-faults When Unsigned Int Variable Is Used?

Feb 20, 2011

I'm writing a tridiagonal solver for sparse linear systems and I coded this decreasing loop:

PHP Code:

xx[NN-1]=gamma[NN-1]*BB[NN-1];
ii=NN-2;
/*Computethexvalues:*/
while(ii>=0){
xx[ii]=gamma[ii]*(BB[ii]+xx[ii+1]);
ii=ii-1;
}

now... if ii is declared as an unsigned integer, the code gives me a segmentation fault, but if I declare it as an int, it doesn't. Using DDD I noticed that, as an unsigned int variable, when I finally decrease it, it underflows and blows up to a huge value, ergo giving me an unaccesible direction for xx in the following iteration! I taugh me not to use unsigned int variables for dereasing loops! XD

View 14 Replies View Related

Programming :: Saving A PPM File - Binary Representation Of Unsigned Chars On The Harddrive

Apr 7, 2010

I am accessing a firewire camera using the libdc1394 library and saving the image as a PPM file, using the code below:

[Code].....

My question is whether the above code is portable. I presume it is, since the result is a binary PPM file which should be capable of being read across multiple computers with different architectures and different operating systems. But at the same time, all that the above code is doing is just saving the binary representation of unsigned chars on the harddrive, and there does not seem to be any reason why the binary representations of the unsigned chars will be identical across multiple computers.

View 1 Replies View Related

Programming :: Char Variable Is Behaving As Unsigned Char?

Feb 14, 2011

i define variable of type char (range -128 to 127). when i tried to print the value after assigning a -ve value to it it displaying a +ve value of that -ve value(256+value).

View 3 Replies View Related

Programming :: Convert A Char * To Unsigned Char?

Mar 4, 2010

is it possible to convert a variable from char * to unsigned char ?

View 5 Replies View Related

Programming :: Get Random Number From -1 To 1 In C?

Mar 4, 2011

i want to generate random number in c programming from -1 to 1

View 1 Replies View Related

Programming :: Clock() - Calculate How Much Time Does My Program Run?

May 11, 2011

im trying to calculate how much time does my program run, use very simple script

clock_t end, start;
start= clock();
int i;
printf("initial %d
",(int)start);
[Code]....

but it outputs 0 all the time. cant figure out where could be the problem.

View 2 Replies View Related

Programming :: Getting The Clock Time From Inside A Driver?

Oct 21, 2010

I want to use a function that able to get the current clock time when I call it from inside my wireless driver?

View 1 Replies View Related

Programming :: Using /dev/random To Generate Double?

Mar 6, 2010

I need to generate random numbers using /dev/random in C. The numbers should be of type double (64-bit floating point).The functionality should be equal to linux command "od -An -N8 -t fD /dev/random", but written in C.The prototype should be "double drand(void);".

View 7 Replies View Related

Programming :: Clock() - Doesn't Count How Much System() Works?

Jun 3, 2011

im stuck with something trivial again. so i want to calculate how much time my programm runs:

int main (int argc, char* argv[])
{
clock_t end, start;
start= clock();
int i;
int p, q, r;
FILE* f_out_loc;
[Code]....

it returns 1.12 sec. looks like clock() doesnt count how much system() works .... is it possible? and how do i calculate the whole thing?

View 4 Replies View Related

Ubuntu :: Conky Clock And Top Panel Clock Not In Sync

May 27, 2011

I'm using a very simple conky script to diplay the date and time on my desktop. I've noticed that he conky clock is a few seconds early compared to the time displayed in the right hand side of the top panel (Natty). I guess both displays are based on the same "internal" time, so I'm left wondering how this could happen, and how to sync back the clocks.

It seems that Conky is in sync with the system date, while the panel clock is 2 seconds late (on my system). Checked with while true; do date; sleep 0.1; done

View 2 Replies View Related

Ubuntu :: Possible To Have Clock In Center Of Task Bar Centered Clock In U11.04?

Aug 2, 2011

Just curious as to if it is possible to have the clock in the center of the task bar centered clock in Ubuntu 11.04?

View 1 Replies View Related

Programming :: Script To Generate Random Dates?

Aug 3, 2010

A script to generate random dates. It uses the year range 2006-2009, and truncates every month of the year to an ordinary February's 28 days, but otherwise it's pretty solid and safe.

Code:
spate=1
while [ $spate -le 120 ]

[code]....

View 1 Replies View Related

Programming :: Random Float Numbers In BASH

Mar 27, 2011

I'm learning shell scripting using bash and I want to generate 4 floating point number with 5 decimal places and write them to a file and a variable. I've done all this except the $RAMDOM enviroment variable does not generate a float number but a integrer.

[code]...

View 4 Replies View Related

Programming :: Random Libraries Are Not Directly Executable?

Jun 30, 2011

Since I read that executing a library could return its version number, I ran "/lib/libc.so.0" on uClinux, but it triggers an error.I'm told that random libraries are not directly executable. Does someone know what a random library is?PS: In case that matters, here's the short version of the error:

Code:
Undefined instruction
<5> - May be used to emulate instructions that are not defined for

[code]....

View 2 Replies View Related

Programming :: MySQL - Get A Random Selection Of An Ordered Data Set

Jan 11, 2011

Given the following data structure: Quote:

[Code]...

What is the minimum possible MySQL query to get a random data selection that includes each Index number only once and ordered ascending. The maximum index number is known. For example running the query should get the following data: 01, 06, 07, 02. Running the query again, you may get the same data or another possible combination like: 01, 05, 07, 04. Of course you could run a loop for 1 to max_index and process a random ordered data selection until the next index number is found. But I think this will result in too many database access. Also you could run max_index queries to get all IDs that correspond to the given index and randomly select one ID for each index.

View 3 Replies View Related

Programming :: Bash: Generating A Random LETTERS Sequence?

May 12, 2011

I tried googling around but i cant find anything related to this: everyone seems just interested in random numbers, so when it comes to random letters there is a lack of informations. However, i am trying to figure out a wait to get a random letters string that matches a simple rule: it must be a sequence of consonant+vowel. So for example, these are some 6 letters strings i would like to obtain: wolupa, tafoke, zewevu, cupimo.

View 3 Replies View Related

Hardware :: Interface To A Quartz Clock That Can Be Used For A TOD Clock?

May 2, 2011

Does anyone know of an interface to a quartz clock that can be used for a TOD clock?? I want to interface it to an Arduino board. Can be GPIO or USB.

View 1 Replies View Related

CentOS 5 :: Get Rid Of Virtual Clock And Use Physical Clock?

Sep 2, 2011

I had cloned a centos 5.6 installation from virtualbox virtual machine to physical box. Everything work fine. However, the time showing in os using date command differs from bios time by roughly 4 hours. I am running ntp services which sync the time with another centos server on the network. It appears that some services are using virtual clock and some use physical clock. How do I get rid of virtual clock and only use physical clock?

View 1 Replies View Related

Programming :: Perl Match Character - Random Sentence Generator ?

Aug 11, 2010

I am trying to make a random sentence generator in perl. So far I can loop it x times to make a fixed quantity of words, but I don't want to do that. Or I can let it go on until I hit ctrl-C :/

I want to have it so that when it reaches a word with a sentence terminating punctuation mark it stops.

My attempt to do that was with:

This is doing the woooosh text until ctrl-C thing...

Now however I am not sure how I can cut off everything after the punctuation mark (when it exists).

View 1 Replies View Related

Ubuntu Multimedia :: Copy Random Jpg From Random Folder

Jan 19, 2010

I'm looking for a script that copies a random .jpg from a random folder in my ~/Pictures folder to my ~/temp folder with a standard filename. This file will then be displayed in Conky. I can fix the last part, but I cannot find a way to do the first part.

View 3 Replies View Related

Fedora :: Installing Unsigned Packages In F12?

Nov 27, 2009

I just installed F12 the other day and I've run into my first problem (this is not a knock, in fact this is probably the best release of Fedora 12 ever for me). Installing Skype from their website. I realise that I'm attempting to install an 1586 binary in x86-64 so it's risky, but that's not the point (yet anyway). I can't even get it to install. I've looked around and can't find anything meaningful on this (other than posts which provided no help). When I try to install the rpm from [URL] with the GUI, I get the message "This action cannot be completed" with the following under details: "The name org.freedesktop.PackageKit was not provided by any .service files". I then tried to install it from a root terminal and got the message, "Package skype-2.1.0.47-fc10.i586.rpm is not signed". Is there a way to change this behavior? And is there a temporary workaround (say, for just this app)? All in all, I love this release, but I cannot recommend Fedora 12 to someone new to Linux without alleviating this issue for them (I'm set to do this tomorrow). This would hamper their efforts to learn how to do basic things, such as installing a random program like Skype.

View 5 Replies View Related

Fedora Installation :: Unsigned RPM, Like Cedega, Or RPM Wizard?

Jun 8, 2009

How do I install an unsigned RPM, like Cedega, or RPM Wizard?

View 1 Replies View Related

Fedora :: Skype Unsigned Endless Loop?

Mar 13, 2010

You are about to install unsigned packages can compromise your system, as it is impossible to verify if the software came from a trusted source. Are you sure you want to continue installation?YES confirm with password same error, yes confirm with pass same error..

View 2 Replies View Related

Software :: Catching Signed And Unsigned Integers In BASH?

Dec 30, 2010

Solving issues with signed and unsigned numbers in BASH.For a start, Yes, BASH is type independent � I know that. My problem lays in catching executables output into a BASH variable.My executables are not quite UNIX compatible, where returned values are 0 for OK, >0 ERROR. They return 0 for OK, >0 WARNING (only, so move on) and <0 ERROR (abort) instead.

Code:
// C++ BIN A
int main(){

[code]...

View 4 Replies View Related

Ubuntu :: 10.04 - Remove Synaptic Unsigned Repos Warning Messages?

Oct 31, 2010

I am running Ubuntu 10.04.How do I make Synaptic stop giving warning messages about unsigned repositories?

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved