Advertisement
MatthijsFontys

javascript get random rgba string

Aug 25th, 2020
1,219
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function getRgba(){
  2.     const prefix = 'rgba(';
  3.     const suffix = ')';
  4.     let addition = '';
  5.     for(let i=0; i<3; i ++){
  6.         addition += Math.floor(Math.random() * 256);
  7.         addition += ',';
  8.     }
  9.     addition += Math.random();
  10.     return prefix + addition + suffix;
  11. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement