#### Category : random

I am having problems getting items in arrays by rate I have total record : 50 Array: $array = [‘banana’ => 30, ‘apple’ => 50, ‘orange’ => 20] I want in 50 records there will be 30% of banana, 50% of apple and 20% of orange. This is my code: public function randomArray(){$total = ..

i am working on very simple project for my school assignment. So it’s a house rent site. Everything seems fine but i want create an automatically invoice like "INV0001" but i dont know how to do that. maybe you guys can help me fix my controller this is my controller public function storeSewa(Request $request){ if .. Read more I am working on a very simple project for my school assignment. So it’s a house rent site. Everything seems fine but I want create an automatically invoice like "INV0001" but I don’t know how to do that. Maybe you guys can help me fix my controller This is my controller public function storeSewa(Request$request){ ..
I have 3 arrays of data: $size = [‘s’,’m’,’x’];$color = [‘white’,’red’,’black’]; $style = [‘AA’,’CC’]; I want to create many new arrays out of this data: [‘s’,’white’,’AA’],[‘s’,’white’,’CC’],[‘s’,’red’,’AA’],[‘s’,’red’,’CC’] I look forward to your help … Sourc.. Read more I use laravel 8. get random 3 users: Users::inRandomOrder()->limit(3)->get(); but I want to add a specific user to the random output. example : Users::find(1); output: // [1, 5, 7, 9] Thanks for helps Sourc.. Read more I’m having a problem with using a basic shuffle() function in Laravel. It returns the same result, which seems to be changing once every 10 or 20 minutes. Here’s the basic code I’m testing:$ar = [‘a’, ‘b’, ‘c’]; shuffle($ar); var_dump($ar); Log::info(json_encode($ar)); And here’s the log: Sourc.. Read more I am trying to generate random values against ‘100’ amount of value for 100 days. I am trying this way with for loop:$total_days = 365; $total_amount = 100;$arr = array(); for($i = 0;$i < $total_days; ++$i) { $arr[] = rand(0.0, 1000.0); }$actual_sum = array_sum($arr); for($i = 0; $i <$total_days; ++\$i) ..