Mail Archives: djgpp/1998/02/05/22:09:10
>Hi ! I started coding some kind of game a few days ago, and was surprised by
>how easy it was to move from Turbo Pascal to C. Allegro is such a wonderful
>piece of code that everything is made easy, even for newcomers. In fact, all
>my problems come from DJGPP itself. And the most important one is that I
>can't find a way to call a limited random(). Was random(10) or anything else
>in Turbo Pascal... what about the same thing with DJGPP ? Thanks to anyone
>who could help me !
>
> Hoi, JCx.
> jicehix AT worldnet DOT fr
>
>P.S: if you answer to the group, please crossport an e-mail :)
>
I think rand() % 10 would do what your looking for - % is the modulus operator,
so it limits a result to that range. I'm not sure this is 'the best' way to do
it, but it should work.
- Raw text -