int i;
i=random(5);
int random(int x)
{
return (rand(x) % 5);
}
rand() is inbuilt function in c/c++;
On Mon, Sep 19, 2011 at 9:24 PM, Don <[email protected]> wrote:
> The most common way that it works would be that random(n) returns the
> equivalent of a random integer mod n, so 0<=x<n. But there is no
> standard for how they work, so know what you are dealing with.
>
> Don
>
> On Sep 19, 10:12 am, prasanth n <[email protected]> wrote:
> > @don:
> > suppose if give like random(5)-> it must give any number between 0 and
> 5..
> >
> >
> >
>
> > On Mon, Sep 19, 2011 at 8:22 PM, Don <[email protected]> wrote:
> > > You mean a pseudo-random generator.
> > > Without special hardware you won't get a real random generator.
> > > Use Mersenne Twister.
> >
> > > Don
> >
> > > On Sep 19, 9:43 am, prasanth n <[email protected]> wrote:
> > > > anyone give an algorithm of how to generate a random
> number..probability
> > > of
> > > > occurrence of each no should be the same..
> >
> > > > --
> > > > *prasanth*
> >
> > > --
> > > You received this message because you are subscribed to the Google
> Groups
> > > "Algorithm Geeks" group.
> > > To post to this group, send email to [email protected].
> > > To unsubscribe from this group, send email to
> > > [email protected].
> > > For more options, visit this group at
> > >http://groups.google.com/group/algogeeks?hl=en.
> >
> > --
> > *prasanth*
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>
>
--
@ |3 # ! /\/ @ \./
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.