# Trait ramp::int::RandomInt [−] [src]

    pub trait RandomInt {
        fn gen_uint(&mut self, bits: usize) -> Int;
        fn gen_int(&mut self, bits: usize) -> Int;
        fn gen_uint_below(&mut self, bound: &Int) -> Int;
        fn gen_int_range(&mut self, lbound: &Int, ubound: &Int) -> Int;
    }

Trait for generating random `Int`.

# Example

Generate a random `Int` of size `256` bits:

    extern crate rand;
    extern crate ramp;

    use ramp::RandomInt;

    fn main() {
        let mut rng = rand::thread_rng();
        let big_i = rng.gen_int(256);
    }

## Required Methods

### `fn gen_uint(&mut self, bits: usize) -> Int`

Generate a random unsigned `Int` of given bit size.

### `fn gen_int(&mut self, bits: usize) -> Int`

Generate a random `Int` of given bit size.

### `fn gen_uint_below(&mut self, bound: &Int) -> Int`

Generate a random unsigned `Int` less than the given bound. Fails when the bound is zero or negative.

### `fn gen_int_range(&mut self, lbound: &Int, ubound: &Int) -> Int`

Generate a random `Int` within the given range. The lower bound is inclusive; the upper bound is exclusive. Fails when the upper bound is not greater than the lower bound.

## Implementors

# Help

## Keyboard Shortcuts

?
  Show this help dialog
S
  Focus the search field
⇤
  Move up in search results
⇥
  Move down in search results
⏎
  Go to active search result

## Search Tricks

Prefix searches with a type followed by a colon (e.g. `fn:`) to restrict the search to a given type.

Accepted types are: `fn`, `mod`, `struct`, `enum`, `trait`, `type`, `macro`, and `const`.

Search functions by type signature (e.g. `vec -> usize` or `* -> vec`)