Re: How to solve this random integer generation problem?
- From: "Ray Koopman" <koopman@xxxxxx>
- Date: 30 Jan 2007 22:42:53 -0800
Jia Lin wrote:
Question:
Given a program which can generate one of {1, 2, 3, 4, 5} randomly.
How can we get another generator which can generate one of
{1,2,3,4,5,6,7} randomly?
Generate two values, x and y. Let z = floor[(5x+y-3)/3].
If z > 7 then try again. Otherwise return z.
(There are many such schemes.)
.
- References:
- How to solve this random integer generation problem?
- From: Jia Lin
- How to solve this random integer generation problem?
- Prev by Date: Re: Searching for near max of unknown function
- Next by Date: Re: how to calculate multivariate normal density if the covariance matrix is singula?
- Previous by thread: How to solve this random integer generation problem?
- Next by thread: Re: How to solve this random integer generation problem?
- Index(es):