Add 'randomBoolean' doc page. (#530)
This commit is contained in:
		
				
					committed by
					
						
						Peli de Halleux
					
				
			
			
				
	
			
			
			
						parent
						
							7a8a1ec7ab
						
					
				
				
					commit
					a60346d4f4
				
			
							
								
								
									
										29
									
								
								docs/blocks/math/random-boolean.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										29
									
								
								docs/blocks/math/random-boolean.md
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,29 @@
 | 
				
			|||||||
 | 
					# random Boolean
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Returns a pseudo-random boolean value that is either `true` or `false`.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					```sig
 | 
				
			||||||
 | 
					Math.randomBoolean()
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## Returns
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					* a pseudo-random [boolean](types/boolean) that is either `true` or `false`.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## Example
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Make your @boardname@ do a coin toss when it's dropped softly. Have the LEDs show 'heads' or 'tails' as the result of the toss.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					```blocks
 | 
				
			||||||
 | 
					input.onGesture(Gesture.FreeFall, () => {
 | 
				
			||||||
 | 
					    if (Math.randomBoolean()) {
 | 
				
			||||||
 | 
					        basic.showIcon(IconNames.Happy)
 | 
				
			||||||
 | 
					    } else {
 | 
				
			||||||
 | 
					        basic.showIcon(IconNames.Sword)
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## See Also
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[random](/reference/math/random)
 | 
				
			||||||
		Reference in New Issue
	
	Block a user