ZVON > References > Haskell reference
| Indexes | Syntax | Prelude | Ratio | Complex | Numeric | Ix | Array | List | Maybe | Char | Monad | IO | Directory | System | Time | Locale | CPUTime | >> Random <<

Module: Random
Function: next
Type: RandomGen a => a -> (Int,a)
Class: RandomGen
Description: The next operation allows one to extract at least 30 bits (one Int's worth) from the generator, returning a new generator as well. The integer returned may be positive or negative.
Related:

Example 1
Program source: 

import Random 

main = do x <- getStdGen
	  print (next x)
	  print (next x)
	  print (fst (next x))
	  setStdGen (snd (next x))
	  print (next x)
	  x <- getStdGen
	  print (next x)
	  newStdGen
	  print (next x)
	  x <- getStdGen
	  print (next x)

Output: (433334474,763021058 329686584)

Output: (433334474,763021058 329686584)

Output: 433334474

Output: (433334474,763021058 329686584)

Output: (473117066,750799641 277682575)

Output: (473117066,750799641 277682575)

Output: (1349143456,750839655 1549179761)