you are viewing a single comment's thread
view the rest of the comments
[–] 17 points 2 years ago (3 children)

Loads of beginners in this thread. Here's how it's done in the industry.

The code:

return a;

The test:

a = rand()%100+1;

It works, boss.

  • source
  • hideshow 3 child comments
  • [–] 4 points 2 years ago* (2 children)

    This must be a custom random function, because it's standard for random to return a float between 0-1 exclusive. Maybe you meant to multiply by 100 instead of modulo.

  • source
  • parent
  • hideshow 2 child comments