x


Excluding values from a Random.range?

Hello. If you are using Random.range to generate values, is there any way to exclude some values within the range (for example: pick a number between 1 and 20, but not 6 through 8)? Thanks

more ▼

asked Dec 29 '10 at 12:22 AM

Tyler 2 gravatar image

Tyler 2
1.1k 212 247 264

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

The Random class doesn't have any built-in support for this, no. But, you can easily write your own code to achieve the same behavior (the details will depend on the context of course).

more ▼

answered Dec 29 '10 at 12:54 AM

Jesse Anders gravatar image

Jesse Anders
7.3k 7 17 48

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x599
x111
x58
x20

asked: Dec 29 '10 at 12:22 AM

Seen: 1327 times

Last Updated: Dec 29 '10 at 12:22 AM