Skip to main content

Questions tagged [drand48]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
1 answer
228 views

Understanding the generate.c function

I am trying to understand this code from the generate.c program: for (int i = 0; i < n; i++) { printf("%i\n", (int) (drand48() * LIMIT)); } I see that the drand48 function returns a ...
Haim's user avatar
  • 185
0 votes
1 answer
425 views

Does (drand48() * LIMIT) generates random numbers upto LIMIT?

(drand48() * LIMIT) Does the above code in 'generate.c' file of pset3 mean that drand48 generates random numbers upto the value defined in LIMIT? E.g - #define LIMITS 234 drand48()*LIMITS In ...
Nitish Panda's user avatar
1 vote
2 answers
564 views

Best solution to move the ball in Breakout?

What's the best solution for providing proper parameters (x,y) for move() function? "Move() function" we use it to move the ball in the Breakout game.
Ibrahim Alawwad's user avatar
0 votes
1 answer
5k views

implicit declaration of function 'drand48()' is invalid in c99 / generating random numbers

I'm now working on pset4 in edx. The spec requires that the velocity of the ball to be generated from a random number using drand48(). I looked at man drand48() saying this is a double type stuff, ...
Hang Man's user avatar
0 votes
2 answers
348 views

pset4 velocity & ball's angle

I'm stuck in step 6. I have understood how to make the ball bounce on the window's edges but I cannot figure out how to make the ball move in an angle. I assume that it has to be some combination of Y-...
PanosVl's user avatar
  • 113
0 votes
1 answer
181 views

drand48() Invalid Operands

This is my code: int min = 6; int max = 9; double x = min + (drand48() * 10) % (max - (min - 1)); Console Error message: Any idea what I am doing wrong?
julio's user avatar
  • 25