all files / src/utils/ random-values.utils.ts

86.67% Statements 13/15
100% Branches 0/0
50% Functions 3/6
85.71% Lines 12/14
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59                      1×                   1×               1×   15×           1×   60× 60×   60×   300×     60×           1×       1×  
/*********************************************************************************************************************************
 This class has been automatically generated using KLTT-APIRestGenerator project, don't do manual file modifications.
 Thu Jul 19 12:37:48 CEST 2018
 
 "Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements;
  and to You under the Apache License, Version 2.0. "
**********************************************************************************************************************************/
 
/**
 * This class contains the common methods for random use
 */
export class RandomValues
{
    /**
	 * Public constructor
	 */
	constructor() { }
	
	/**
	 * @return a random boolean
	 */
	static generateRandomBoolean()
	{
		return Math.random() >= 0.5 ;
	}
	
	/**
	 * @return a random number
	 */
	static generateRandomNumber()
	{
		return Math.floor((Math.random() * 10) + 1) ;
	}
	
	/**
	 * @return a random string
	 */	
	static generateRandomString()
	{
	    var randomString = "" ;
	    var possible 	 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789" ;
	
	    for(var i=0; i < 5; i++)
	   	{
	        randomString += possible.charAt(Math.floor(Math.random() * possible.length)) ;
		}
		
	    return randomString ;
	}
	
	/**
	 * @return a random file
	 */	
	static generateRandomFile()
	{
        return "dummyLocation" ;
	}
};