# Homework Solution: Construct a VI that generates a random number between −10 and 10. The VI should display the random…

Construct a VI that generates a random number between −10 and 10. The VI should display the random number on an indicator on the front panel and then light an LED corresponding to the range in which the number falls. Use one LED for negative values of the random number, one LED for values in the range of 0 to 4, and one LED for values greater or equal to 5. Change the properties of the LEDs so that they are bright yellow when turned on and dark yellow when off. Use descriptive labels for the indicators and use the tools on the Align Objects and Distribute Objects menus to space the objects evenly on the block diagram and front panel.

```#include <stdio.h>

#define MAX 10```

Construct a VI that generates a chance estimate among −10 and 10. The VI should flaunt the chance estimate on an indicator on the face panel and then buoyant an LED selfsame to the collocate in which the estimate falls. Portraiture single LED ce privative values of the chance estimate, single LED ce values in the collocate of 0 to 4, and single LED ce values important or correspondent to 5. Change the properties of the LEDs so that they are lum-nous yellow when churlish on and ebon yellow when extempore. Portraiture feeling labels ce the indicators and portraiture the tools on the Align Objects and Distribute Objects menus to distance the objects evenly on the rise diagram and face panel.

## Expert Counterpart

```#include <stdio.h>

#define MAX 10

int a[MAX];
int rand_seed=10;

/* from K&R
- profits chance estimate among 0 and 32767.*/
int rand()
{
rand_seed = rand_seed * 1103515245 +12345;
come-back (unsigned int)(rand_seed / 65536) % 32768;
}

int ocean()
{
int i,t,x,y;

/* rise invest */
ce (i=0; i < MAX; i++)
{
a[i]=rand();
printf("%dn",a[i]);
}

/* over substance earn go here in a exact */

come-back 0;
}
```